strings_func.h

Go to the documentation of this file.
00001 /* $Id: strings_func.h 22393 2011-04-30 20:50:41Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef STRINGS_FUNC_H
00013 #define STRINGS_FUNC_H
00014 
00015 #include "strings_type.h"
00016 #include "string_type.h"
00017 
00018 char *InlineString(char *buf, StringID string);
00019 char *GetString(char *buffr, StringID string, const char *last);
00020 char *GetStringWithArgs(char *buffr, uint string, int64 *argv, const int64 *argve, const char *last, WChar *argt = NULL);
00021 const char *GetStringPtr(StringID string);
00022 
00023 void InjectDParam(uint amount);
00024 
00031 static inline void SetDParamX(uint64 *s, uint n, uint64 v)
00032 {
00033   s[n] = v;
00034 }
00035 
00041 static inline void SetDParam(uint n, uint64 v)
00042 {
00043   extern uint64 _decode_parameters[20];
00044 
00045   assert(n < lengthof(_decode_parameters));
00046   _decode_parameters[n] = v;
00047 }
00048 
00049 void SetDParamStr(uint n, const char *str);
00050 
00057 static inline uint64 GetDParamX(const uint64 *s, uint n)
00058 {
00059   return s[n];
00060 }
00061 
00067 static inline uint64 GetDParam(uint n)
00068 {
00069   extern uint64 _decode_parameters[20];
00070 
00071   assert(n < lengthof(_decode_parameters));
00072   return _decode_parameters[n];
00073 }
00074 
00081 static inline void CopyInDParam(int offs, const uint64 *src, int num)
00082 {
00083   extern uint64 _decode_parameters[20];
00084   memcpy(_decode_parameters + offs, src, sizeof(uint64) * (num));
00085 }
00086 
00093 static inline void CopyOutDParam(uint64 *dst, int offs, int num)
00094 {
00095   extern uint64 _decode_parameters[20];
00096   memcpy(dst, _decode_parameters + offs, sizeof(uint64) * (num));
00097 }
00098 
00099 extern TextDirection _current_text_dir; 
00100 
00101 void InitializeLanguagePacks();
00102 const char *GetCurrentLanguageIsoCode();
00103 
00104 int CDECL StringIDSorter(const StringID *a, const StringID *b);
00105 
00107 struct StringIDCompare
00108 {
00109   bool operator()(StringID s1, StringID s2) const { return StringIDSorter(&s1, &s2) < 0; }
00110 };
00111 
00112 void CheckForMissingGlyphsInLoadedLanguagePack();
00113 
00114 #endif /* STRINGS_FUNC_H */

Generated on Sun May 15 19:20:15 2011 for OpenTTD by  doxygen 1.6.1