LangResource.cpp

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #include <lang/LangResource.h>
00022 
00023 LangString LangResource::getKey(const std::string &key, const std::string &value)
00024 {
00025         ResourceBundleEntry *bundle = Lang::instance()->getEntry(key, value);
00026         LangString result = bundle->getString();
00027         return result;
00028 }
00029 
00030 LangString LangResource::getKey(const std::string &key, const std::string &value, 
00031         const LangStringConverter &param1)
00032 {
00033         ResourceBundleEntry *bundle = Lang::instance()->getEntry(key, value);
00034         LangString result = bundle->getString(param1);
00035         return result;
00036 }
00037 
00038 LangString LangResource::getKey(const std::string &key, const std::string &value, 
00039         const LangStringConverter &param1, const LangStringConverter &param2)
00040 {
00041         ResourceBundleEntry *bundle = Lang::instance()->getEntry(key, value);
00042         LangString result = bundle->getString(param1, param2);
00043         return result;
00044 }
00045 
00046 LangString LangResource::getKey(const std::string &key, const std::string &value, 
00047         const LangStringConverter &param1, const LangStringConverter &param2, const LangStringConverter &param3)
00048 {
00049         ResourceBundleEntry *bundle = Lang::instance()->getEntry(key, value);
00050         LangString result = bundle->getString(param1, param2, param3);
00051         return result;
00052 }
00053 
00054 LangString LangResource::getKey(const std::string &key, const std::string &value, 
00055         const LangStringConverter &param1, const LangStringConverter &param2, const LangStringConverter &param3, const LangStringConverter &param4)
00056 {
00057         ResourceBundleEntry *bundle = Lang::instance()->getEntry(key, value);
00058         LangString result = bundle->getString(param1, param2, param3, param4);
00059         return result;
00060 }
00061 
00062 static void testMacro()
00063 {
00064         LANG_RESOURCE("hmm", "hmm value");
00065 
00066         LANG_RESOURCE_VAR(bob_0, "test", "test value");
00067         bob_0.c_str();
00068 
00069         LANG_RESOURCE_VAR_1(bob_1, "test", "test value {0}", "1");
00070         bob_1.c_str();
00071 
00072         LANG_RESOURCE_VAR_2(bob_2, "test", "test value {0} {1}", "1", "2");
00073         bob_2.c_str();
00074 
00075         LANG_RESOURCE_VAR_3(bob_3, "test", "test value {0} {1} {2}", "1", "2", "3");
00076         bob_3.c_str();
00077 
00078         LANG_RESOURCE_VAR_4(bob_4, "test", "test value {0} {1} {2} {3}", "1", "2", "3", "4");
00079         bob_4.c_str();
00080 
00081         LANG_RESOURCE_CONST_VAR(bob_c_0, "test", "test value");
00082         bob_c_0.c_str();
00083 
00084         LANG_RESOURCE_CONST_VAR_1(bob_c_1, "test {0}", "test value", "1");
00085         bob_c_1.c_str();
00086 
00087         LANG_RESOURCE_CONST_VAR_2(bob_c_2, "test {0} {1}", "test value", "1", "2");
00088         bob_c_2.c_str();
00089 
00090         LANG_RESOURCE_CONST_VAR_3(bob_c_3, "test {0} {1} {2}", "test value", "1", "2", "3");
00091         bob_c_3.c_str();
00092 
00093         LANG_RESOURCE_CONST_VAR_4(bob_c_4, "test {0} {1} {2} {3}", "test value", "1", "2", "3", "4");
00094         bob_c_4.c_str();
00095 }

Generated on Mon Feb 16 15:14:50 2009 for Scorched3D by  doxygen 1.5.3