/usr/include/Unidraw/catalog.h is in ivtools-dev 1.2.11a1-11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | /*
* Copyright (c) 1990, 1991 Stanford University
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Stanford not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Stanford makes no representations about
* the suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
* IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Catalog - manages persistent information.
*/
#ifndef unidraw_catalog_h
#define unidraw_catalog_h
#include <inttypes.h>
#include <Unidraw/classes.h>
#include <Unidraw/uformat.h>
#include <Unidraw/uhash.h>
#include <Unidraw/umap.h>
class Bitmap;
class Clipboard;
class Command;
class Component;
class ControlInfo;
class Creator;
class EditorInfo;
class NameMap;
class ObjectMap;
class ObjectMapElem;
class PSBrush;
class PSColor;
class PSFont;
class PSPattern;
class Raster;
class StateVar;
class Tool;
class TransferFunct;
class Transformer;
class UArray;
class UHashTable;
class Unidraw;
class UList;
class World;
#include <iosfwd>
//: stores and retrieves named objects.
// <a href=../man3.1/Catalog.html>man page</a>
class Catalog {
public:
Catalog(const char*, Creator*, float version = UV_LATEST);
virtual ~Catalog();
virtual boolean Save(EditorInfo*, const char*);
virtual boolean Save(Component*, const char*);
virtual boolean Save(Command*, const char*);
virtual boolean Save(Tool*, const char*);
virtual boolean Retrieve(const char*, EditorInfo*&);
virtual boolean Retrieve(const char*, Component*&);
virtual boolean Retrieve(const char*, Command*&);
virtual boolean Retrieve(const char*, Tool*&);
virtual void Forget(EditorInfo*, const char* = nil);
virtual void Forget(Component*, const char* = nil);
virtual void Forget(Command*, const char* = nil);
virtual void Forget(Tool*, const char* = nil);
virtual const char* GetName(EditorInfo*);
virtual const char* GetName(Component*);
virtual const char* GetName(Command*);
virtual const char* GetName(Tool*);
virtual boolean Valid(const char*, EditorInfo*&);
virtual boolean Valid(const char*, Component*&);
virtual boolean Valid(const char*, Command*&);
virtual boolean Valid(const char*, Tool*&);
virtual Component* Copy(Component*);
virtual Command* Copy(Command*);
virtual Tool* Copy(Tool*);
virtual boolean Exists(const char*);
virtual boolean Writable(const char*);
void SetClipboard(Clipboard*);
void SetEditorInfo(EditorInfo*);
Clipboard* GetClipboard();
EditorInfo* GetEditorInfo();
const char* GetName();
Creator* GetCreator();
float GetVersion();
float FileVersion();
const char* GetAttribute(const char*);
virtual float ReadVersion(istream&);
virtual Component* ReadComponent(istream&);
virtual Command* ReadCommand(istream&);
virtual Tool* ReadTool(istream&);
virtual StateVar* ReadStateVar(istream&);
virtual TransferFunct* ReadTransferFunct(istream&);
virtual void WriteVersion(float, ostream&);
virtual void WriteComponent(Component*, ostream&);
virtual void WriteCommand(Command*, ostream&);
virtual void WriteTool(Tool*, ostream&);
virtual void WriteStateVar(StateVar*, ostream&);
virtual void WriteTransferFunct(TransferFunct*, ostream&);
PSBrush* ReadBrush(const char*, int index); // read from Xdefaults
PSColor* ReadColor(const char*, int index);
PSFont* ReadFont(const char*, int index);
PSPattern* ReadPattern(const char*, int index);
void Skip(istream&);
void Mark(ostream&);
int ReadBgFilled(istream&);
PSBrush* ReadBrush(istream&);
PSColor* ReadColor(istream&);
PSFont* ReadFont(istream&);
PSPattern* ReadPattern(istream&);
Transformer* ReadTransformer(istream&);
char* ReadString(istream&);
ControlInfo* ReadControlInfo(istream&);
EditorInfo* ReadEditorInfo(istream&);
Bitmap* ReadBitmap(istream&);
void ReadBitmapData(Bitmap*, istream&);
Raster* ReadGraymap(istream&);
void ReadGraymapData(Raster*, istream&);
Raster* ReadRaster(istream&);
void ReadRasterData(Raster*, istream&);
void WriteBgFilled(int, ostream&);
void WriteBrush(PSBrush*, ostream&);
void WriteColor(PSColor*, ostream&);
void WriteFont(PSFont*, ostream&);
void WritePattern(PSPattern*, ostream&);
void WriteTransformer(Transformer*, ostream&);
void WriteString(const char*, ostream&);
void WriteControlInfo(ControlInfo*, ostream&);
void WriteEditorInfo(EditorInfo*, ostream&);
void WriteBitmap(Bitmap*, ostream&);
void WriteBitmapData(Bitmap*, ostream&);
void WriteGraymap(Raster*, ostream&);
void WriteGraymapData(Raster*, ostream&);
void WriteRaster(Raster*, ostream&);
void WriteRasterData(Raster*, ostream&);
PSBrush* FindNoneBrush();
PSBrush* FindBrush(int, int);
PSBrush* FindBrush(int, float);
PSColor* FindColor(const char*, int = 0, int = 0, int = 0);
PSColor* FindNoneColor();
PSFont* FindFont(const char*, const char* = "", const char* = "");
PSPattern* FindNonePattern();
PSPattern* FindGrayLevel(float);
PSPattern* FindPattern(int[], int);
void Register(EditorInfo*, const char*);
void Register(Component*, const char*);
void Register(Command*, const char*);
void Register(Tool*, const char*);
int GetToken(istream& in, char* buf, int buf_size);
protected:
friend class Unidraw;
void Init(World*);
public:
const char* Name(const char*, int);
protected:
ClassId ReadClassId(istream&, int& inst_id, ClassId&, const char*&);
void* ReadObject(istream&);
void* ReadSubstObject(
istream&, int inst_id, ClassId orig_id, ClassId subst_id,
const char* delim
);
void ReadExtraData(istream&, const char* delim, UArray*);
void WriteClassId(
ClassId, ostream&, int inst_id = 0,
ClassId subst_id = UNDEFINED_CLASS, const char* delim = ""
);
void WriteClassId(void*, ClassId, ostream&, int id = 0);
void WriteObject(void*, ClassId, ostream&);
void WriteIt(void*, ClassId, ostream&);
void* CopyObject(void*, ClassId);
void Forget(void*, const char* name, NameMap*);
boolean SaveObject(void*, ClassId, ostream&);
boolean RetrieveObject(istream&, void*&);
boolean FileSave(void*, ClassId, const char*);
boolean FileRetrieve(const char*, void*&);
protected:
char* _name;
Creator* _creator;
float _version;
Clipboard* _clipboard;
EditorInfo* _edInfo;
World* _world;
UList* _brs;
UList* _colors;
UList* _fonts;
UList* _pats;
ObjectMap* _curMap;
ObjectMap* _substMap;
float _fileVersion;
#ifdef __GNUC__
char* _tmpfile;
#endif
NameMap* _edInfoMap;
NameMap* _compMap;
NameMap* _cmdMap;
NameMap* _toolMap;
};
inline const char* Catalog::GetName () { return _name; }
inline Creator* Catalog::GetCreator () { return _creator; }
inline float Catalog::GetVersion () { return _version; }
inline float Catalog::FileVersion () { return _fileVersion; }
inline Clipboard* Catalog::GetClipboard () { return _clipboard; }
inline EditorInfo* Catalog::GetEditorInfo () { return _edInfo; }
class ObjectMap : public UMap {
public:
ObjectMap(void* client, ClassId clientId);
void Register(void* obj, intptr_t id);
void Register(
void* obj, intptr_t id, ClassId orig_id, const char* delim,
UArray* extra_data
);
void Unregister(void* obj);
void Unregister(intptr_t id);
void* GetClient();
ClassId GetClientId();
void* GetObject(intptr_t id);
unsigned long GetId(void* obj);
ClassId GetOrigClassId(void* obj);
const char* GetDelim(void* obj);
UArray* GetExtraData(void* obj);
protected:
ObjectMapElem* Find(void*);
ObjectMapElem* Find(intptr_t);
protected:
UHashTable _objKeys, _idKeys;
void* _client;
ClassId _id;
};
#endif
|