HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ColorList.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: (UT_ColorList.h, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef _UT_ColorList_
12 #define _UT_ColorList_
13 
14 #include "UT_API.h"
15 #include "UT_String.h"
16 #include "UT_Color.h"
17 #include "UT_IndexedHashMapT.h"
18 
20 {
21 public:
22  UT_ColorList();
23 
24  // Load the given file on startup
25  UT_ColorList(const char* rgbfile);
26 
27  virtual ~UT_ColorList();
28 
29  // Load colors from rgbfile (in X11 rgb.txt format)
30  void loadFile(const char* rgbfile);
31 
32  // Was there an error parsing the file?
33  bool error() const { return myIsError; };
34 
35  // Get the number or errors, and the line and description of the first
36  // error in the file
37  void getError(int& nerrors, int& errline, UT_String& errmsg) const;
38 
39  // How many colors are in the list
40  uint numColors() const;
41 
42  // Get a color by name
43  UT_Color getColor(const char* colorname) const;
44 
45  // Get a color by index
46  UT_Color getColor(uint i) const;
47 
48  // Get the name of the color at index i
49  const UT_StringHolder &getColorName(uint i) const;
50 
51 protected:
53  typedef UT_Color MapItem;
54 
55  bool myIsError;
57  int myErrLine;
60 };
61 
62 #endif
UT_String myErrMsg
Definition: UT_ColorList.h:58
#define UT_API
Definition: UT_API.h:14
A thread-safe hash map which stores indexed shared items.
UT_IndexedHashMapT< MapKey, MapItem > myColors
Definition: UT_ColorList.h:59
UT_Color MapItem
Definition: UT_ColorList.h:53
UT_IndexedHashMapStringKey MapKey
Definition: UT_ColorList.h:52
unsigned int uint
Definition: SYS_Types.h:45
bool error() const
Definition: UT_ColorList.h:33