Restore the "GPL licensing not permitted" in GLUT license headers.
[haiku.git] / headers / os / storage / ResourceStrings.h
blobf5f6cde3b2dd3342fb80b4297a7b773e88bcb97f
1 /*
2 * Copyright 2001-2010, Haiku Inc.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _RESOURCE_STRINGS_H
6 #define _RESOURCE_STRINGS_H
9 #include <Entry.h>
10 #include <Locker.h>
13 class BResources;
14 class BString;
17 /*! \brief Simple class to access the string resources in a file.
19 A BResourceStrings object reads the string type resources from a given
20 resource file and provides fast read only access to them.
22 class BResourceStrings {
23 public:
24 BResourceStrings();
25 BResourceStrings(const entry_ref& ref);
26 virtual ~BResourceStrings();
28 status_t InitCheck();
29 virtual BString* NewString(int32 id);
30 virtual const char* FindString(int32 id);
32 virtual status_t SetStringFile(const entry_ref* ref);
33 status_t GetStringFile(entry_ref* outRef);
35 enum {
36 RESOURCE_TYPE = 'CSTR'
39 protected:
40 struct _string_id_hash {
41 _string_id_hash();
42 ~_string_id_hash();
44 void assign_string(const char* str, bool makeCopy);
46 _string_id_hash* next;
47 int32 id;
48 char* data;
49 bool data_alloced;
50 bool _reserved1[3];
51 uint32 _reserved2;
54 private:
55 void _Cleanup();
56 void _MakeEmpty();
57 status_t _Rehash(int32 newSize);
58 _string_id_hash* _AddString(char* str, int32 id,
59 bool wasMalloced);
61 virtual _string_id_hash* _FindString(int32 id);
63 virtual status_t _Reserved_ResourceStrings_0(void*);
64 virtual status_t _Reserved_ResourceStrings_1(void*);
65 virtual status_t _Reserved_ResourceStrings_2(void*);
66 virtual status_t _Reserved_ResourceStrings_3(void*);
67 virtual status_t _Reserved_ResourceStrings_4(void*);
68 virtual status_t _Reserved_ResourceStrings_5(void*);
70 protected:
71 BLocker _string_lock;
72 status_t _init_error;
74 private:
75 entry_ref fFileRef;
76 BResources *fResources;
77 _string_id_hash **fHashTable;
78 int32 fHashTableSize;
79 int32 fStringCount;
80 uint32 _reserved[16]; // FBC
84 #endif // _RESOURCE_STRINGS_H