Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/pandatoolbase/pathStore.cxx

Go to the documentation of this file.
00001 // Filename: pathStore.cxx
00002 // Created by:  drose (10Feb03)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "pathStore.h"
00020 
00021 #include "string_utils.h"
00022 #include "notify.h"
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //     Function: format_path_store
00026 //  Description: Returns the string corresponding to this method.
00027 ////////////////////////////////////////////////////////////////////
00028 string
00029 format_path_store(PathStore store) {
00030   switch (store) {
00031   case PS_invalid:
00032     return "invalid";
00033 
00034   case PS_relative:
00035     return "relative";
00036 
00037   case PS_absolute:
00038     return "absolute";
00039 
00040   case PS_rel_abs:
00041     return "rel_abs";
00042 
00043   case PS_strip:
00044     return "strip";
00045 
00046   case PS_keep:
00047     return "keep";
00048   }
00049   nout << "**unexpected PathStore value: (" << (int)store << ")**";
00050   return "**";
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function: PathStore output operator
00055 //  Description:
00056 ////////////////////////////////////////////////////////////////////
00057 ostream &
00058 operator << (ostream &out, PathStore store) {
00059   return out << format_path_store(store);
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: string_path_store
00064 //  Description: Stores from a string, as might be input by the
00065 //               user, to one of the known PathStore types.
00066 //               Returns PS_invalid if the string is unknown.
00067 ////////////////////////////////////////////////////////////////////
00068 PathStore
00069 string_path_store(const string &str) {
00070   if (cmp_nocase(str, "relative") == 0 || 
00071       cmp_nocase(str, "rel") == 0) {
00072     return PS_relative;
00073 
00074   } else if (cmp_nocase(str, "absolute") == 0 ||
00075              cmp_nocase(str, "abs") == 0) {
00076     return PS_absolute;
00077 
00078   } else if (cmp_nocase_uh(str, "rel_abs") == 0) {
00079     return PS_rel_abs;
00080 
00081   } else if (cmp_nocase(str, "strip") == 0) {
00082     return PS_strip;
00083 
00084   } else if (cmp_nocase(str, "keep") == 0) {
00085     return PS_keep;
00086 
00087   } else {
00088     return PS_invalid;
00089   }
00090 }

Generated on Fri May 2 03:21:29 2003 for Panda-Tool by doxygen1.3