00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "autoTextureScale.h"
00016 #include "string_utils.h"
00017 #include "config_util.h"
00018
00019 ostream &
00020 operator << (ostream &out, AutoTextureScale ats) {
00021 switch (ats) {
00022 case ATS_none:
00023 return out << "none";
00024
00025 case ATS_down:
00026 return out << "down";
00027
00028 case ATS_up:
00029 return out << "up";
00030
00031 case ATS_pad:
00032 return out << "pad";
00033
00034 case ATS_unspecified:
00035 return out << "unspecified";
00036 }
00037
00038 return out << "**invalid AutoTextureScale (" << (int)ats << ")**";
00039 }
00040
00041 istream &
00042 operator >> (istream &in, AutoTextureScale &ats) {
00043 string word;
00044 in >> word;
00045
00046 if (cmp_nocase(word, "none") == 0 ||
00047 cmp_nocase(word, "0") == 0 ||
00048 cmp_nocase(word, "#f") == 0 ||
00049 (!word.empty() && tolower(word[0]) == 'f')) {
00050 ats = ATS_none;
00051
00052 } else if (cmp_nocase(word, "down") == 0 ||
00053 cmp_nocase(word, "1") == 0 ||
00054 cmp_nocase(word, "#t") == 0 ||
00055 (!word.empty() && tolower(word[0]) == 't')) {
00056 ats = ATS_down;
00057
00058 } else if (cmp_nocase(word, "up") == 0) {
00059 ats = ATS_up;
00060
00061 } else if (cmp_nocase(word, "pad") == 0) {
00062 ats = ATS_pad;
00063
00064 } else {
00065 util_cat->error() << "Invalid AutoTextureScale value: " << word << "\n";
00066 ats = ATS_none;
00067 }
00068
00069 return in;
00070 }