Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. #pragma once
  2. #include <vector>
  3. using LocalizeStringIndex_t = unsigned;
  4. struct Kit_t
  5. {
  6. int id;
  7. std::string name;
  8.  
  9. bool operator < (const Kit_t& other) const { return (name < other.name); }
  10. };
  11. class ILocalizeTextQuery
  12. {
  13. public:
  14. virtual int ComputeTextWidth(const wchar_t* pString) = 0;
  15. };
  16. using CreateInterfaceFn2 = void* (*)(const char*, int*);
  17.  
  18. template <class T>
  19. T* CaptureInterface2(const char* module, const char* name)
  20. {
  21. return reinterpret_cast<T*>(platform::CaptureInterface2(module, name));
  22. }
  23. enum InitReturnVal_t
  24. {
  25. INIT_FAILED = 0,
  26. INIT_OK,
  27.  
  28. INIT_LAST_VAL,
  29. };
  30.  
  31. enum AppSystemTier_t
  32. {
  33. APP_SYSTEM_TIER0 = 0,
  34. APP_SYSTEM_TIER1,
  35. APP_SYSTEM_TIER2,
  36. APP_SYSTEM_TIER3,
  37.  
  38. APP_SYSTEM_TIER_OTHER,
  39. };
  40.  
  41. struct AppSystemInfo_t;
  42.  
  43. class IAppSystem2
  44. {
  45. public:
  46. virtual bool Connect(CreateInterfaceFn2 factory) = 0;
  47. virtual void Disconnect() = 0;
  48. virtual void* QueryInterface(const char* pInterfaceName) = 0;
  49. virtual InitReturnVal_t Init() = 0;
  50. virtual void Shutdown() = 0;
  51. virtual const AppSystemInfo_t* GetDependencies() = 0;
  52. virtual AppSystemTier_t GetTier() = 0;
  53. virtual void Reconnect(CreateInterfaceFn2 factory, const char* pInterfaceName) = 0;
  54. virtual bool IsSingleton() = 0;
  55. };
  56.  
  57. class ILocalize : public IAppSystem2
  58. {
  59. public:
  60. virtual bool AddFile(const char* fileName, const char* pPathID = nullptr, bool bIncludeFallbackSearchPaths = false) = 0;
  61. virtual void RemoveAll() = 0;
  62. virtual wchar_t* Find(const char* tokenName) = 0;
  63. virtual const wchar_t* FindSafe(const char* tokenName) = 0;
  64. virtual int ConvertANSIToUnicode(const char* ansi, wchar_t* unicode, int unicodeBufferSizeInBytes) = 0;
  65. virtual int ConvertUnicodeToANSI(const wchar_t* unicode, char* ansi, int ansiBufferSize) = 0;
  66. virtual LocalizeStringIndex_t FindIndex(const char* tokenName) = 0;
  67. virtual void ConstructString(wchar_t* unicodeOuput, int unicodeBufferSizeInBytes, const wchar_t* formatString, int numFormatParameters, ...) = 0;
  68. virtual const char* GetNameByIndex(LocalizeStringIndex_t index) = 0;
  69. virtual wchar_t* GetValueByIndex(LocalizeStringIndex_t index) = 0;
  70. };
  71.  
  72. #define ILOCALIZE_CLIENT_INTERFACE_VERSION "Localize_001"
  73. extern ILocalize* g_localize;
  74.  
  75. extern std::vector<Kit_t> k_skins;
  76. extern std::vector<Kit_t> k_gloves;
  77. extern std::vector<Kit_t> k_stickers;
  78.  
  79. extern void InitializeKits();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement