open_toontown_panda3d/panda/src/putil/bamTextureMode.cxx

64 lines
1.5 KiB
C++

// Filename: bamTextureMode.cxx
// Created by: drose (14Mar06)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#include "bamTextureMode.h"
#include "config_util.h"
#include "string_utils.h"
ostream &
operator << (ostream &out, BamTextureMode btm) {
switch (btm) {
case BTM_unchanged:
return out << "unchanged";
case BTM_fullpath:
return out << "fullpath";
case BTM_relative:
return out << "relative";
case BTM_basename:
return out << "basename";
case BTM_rawdata:
return out << "rawdata";
}
return out << "**invalid BamTextureMode (" << (int)btm << ")**";
}
istream &
operator >> (istream &in, BamTextureMode &btm) {
string word;
in >> word;
if (cmp_nocase(word, "unchanged") == 0) {
btm = BTM_unchanged;
} else if (cmp_nocase(word, "fullpath") == 0) {
btm = BTM_fullpath;
} else if (cmp_nocase(word, "relative") == 0) {
btm = BTM_relative;
} else if (cmp_nocase(word, "basename") == 0) {
btm = BTM_basename;
} else if (cmp_nocase(word, "rawdata") == 0) {
btm = BTM_rawdata;
} else {
util_cat->error() << "Invalid BamTextureMode value: " << word << "\n";
btm = BTM_relative;
}
return in;
}