00001 /// \file CATStringTable.h 00002 /// \brief String table for internationalization 00003 /// \ingroup CAT 00004 /// 00005 /// Copyright (c) 2007-2008 by Michael Ellison. 00006 /// See COPYING.txt for the \ref gaslicense License (MIT License). 00007 /// 00008 // $Author: mikeellison $ 00009 // $Date: 2008-01-12 11:38:12 -0600 (Sat, 12 Jan 2008) $ 00010 // $Revision: $ 00011 // $NoKeywords: $ 00012 00013 #ifndef _CATStringTable_H_ 00014 #define _CATStringTable_H_ 00015 00016 #include "CATInternal.h" 00017 00018 enum CATLangId 00019 { 00020 CATLANG_EN 00021 }; 00022 00023 /// \class CATStringTable 00024 /// \brief Base class for string tables for internationalization 00025 /// \ingroup CAT 00026 /// 00027 /// Right now this is just a place holder, really. 00028 /// 00029 /// We need to move the result declarations and associated strings 00030 /// to a seperate process where they are autogenerated. In the meantime, though, 00031 /// having at least this much abstractions will allow us to do the conversion to 00032 /// an external string table later much more easily. 00033 /// 00034 /// Note on usage: GetString() should be safe to call across threads by itself. 00035 /// HOWEVER, it would not be safe while another thread was mucking with the 00036 /// AddSubTable() / RemoveSubTable() functions. My suggestion would be to 00037 /// load up the string tables in main() prior to starting threads. 00038 /// 00039 /// Failing that, the add/remove procedures will need to be synchronized 00040 /// against GetString(). This is not currently done. 00041 /// 00042 class CATStringTable 00043 { 00044 public: 00045 CATStringTable (); 00046 virtual ~CATStringTable (); 00047 00048 CATResult AddSubTable ( CATStringTable* childTable ); 00049 CATResult RemoveSubTable ( CATStringTable* childTable ); 00050 virtual const CATWChar* GetString ( CATResult stringId, 00051 CATLangId langId = CATLANG_EN) const; 00052 protected: 00053 std::vector<CATStringTable*> fSubTables; 00054 }; 00055 00056 #endif // _CATStringTable_H_