diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2011-03-28 13:31:44 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2011-03-28 13:31:44 +0400 |
commit | bd9854e7d1dee9b59ccab146c43db542e4873171 (patch) | |
tree | 9a60f633b6311451573da62eb9feeeff865e8d2d /source/blender/collada/ExtraTags.cpp | |
parent | e5bf21898ea7fdc9d13b4f046fcbcf16064c6df4 (diff) |
Import light blender profile if it exists.
Diffstat (limited to 'source/blender/collada/ExtraTags.cpp')
-rw-r--r-- | source/blender/collada/ExtraTags.cpp | 72 |
1 files changed, 69 insertions, 3 deletions
diff --git a/source/blender/collada/ExtraTags.cpp b/source/blender/collada/ExtraTags.cpp index 772c20c6c4f..57305d1ae79 100644 --- a/source/blender/collada/ExtraTags.cpp +++ b/source/blender/collada/ExtraTags.cpp @@ -33,18 +33,84 @@ #include "ExtraTags.h" -ExtraTags::ExtraTags(const std::string profile) +ExtraTags::ExtraTags( std::string profile) { this->profile = profile; + this->tags = std::map<std::string, std::string>(); } ExtraTags::~ExtraTags() { } -bool ExtraTags::addTag(const std::string tag, const std::string data) +bool ExtraTags::addTag( std::string tag, std::string data) { - std::cout << "ready to add " << tag << ": " << data << "." << std::endl; + tags[tag] = data; return true; } + +int ExtraTags::asInt( std::string tag, bool *ok) +{ + if(tags.find(tag) == tags.end()) { + *ok = false; + return -1; + } + *ok = true; + return atoi(tags[tag].c_str()); +} + +float ExtraTags::asFloat( std::string tag, bool *ok) +{ + if(tags.find(tag) == tags.end()) { + *ok = false; + return -1.0f; + } + *ok = true; + return (float)atof(tags[tag].c_str()); +} + +std::string ExtraTags::asString( std::string tag, bool *ok) +{ + if(tags.find(tag) == tags.end()) { + *ok = false; + return ""; + } + *ok = true; + return tags[tag]; +} + + +void ExtraTags::setData(std::string tag, short *data) +{ + bool ok = false; + int tmp = 0; + tmp = asInt(tag, &ok); + if(ok) + *data = (short)tmp; +} +void ExtraTags::setData(std::string tag, int *data) +{ + bool ok = false; + int tmp = 0; + tmp = asInt(tag, &ok); + if(ok) + *data = tmp; +} +void ExtraTags::setData(std::string tag, float *data) +{ + bool ok = false; + float tmp = 0.0f; + tmp = asFloat(tag, &ok); + if(ok) + *data = tmp; +} +void ExtraTags::setData(std::string tag, char *data) +{ + bool ok = false; + int tmp = 0; + tmp = asInt(tag, &ok); + if(ok) + *data = (char)tmp; +} +
\ No newline at end of file |