/usr/include/OverlayUnidraw/scriptview.h is in ivtools-dev 1.2.11a1-2.
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 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | /*
* Copyright (C) 2002 Scott E. Johnston
* Copyright (C) 1994-1997,1999 Vectaport Inc.
*
* 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 names of the copyright holders not be used in
* advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. The copyright holders make
* no representation about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
* IN NO EVENT SHALL THEY 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.
*/
/*
* OverlayScript - command-oriented external representation of component.
*/
#ifndef script_view_h
#define script_view_h
#include <OverlayUnidraw/ovpsview.h>
class Clipboard;
class OverlayComp;
class OverlaysComp;
class OverlayIdrawComp;
#include <iosfwd>
//: serialized view of OverlayComp.
// the OverlayScript class hierarchy is a tree of ExternView classes
// that are derived from OverlayPS and PostScriptView for convenience,
// to inherit a complete mechanism for writing and reading graphical data.
// <p>
// This capability is similar to the serialization mechanism of JavaBeans,
// but there is no need for a versioning system because the format used
// for the ASCII serialization supports arbitrary extension of an object's
// format by adding defaulted keyword-prefixed arguments.
// <p>
// An older program can read newer formats, because the deserialization
// is set up to convert unknown keyword arguments into attributes on
// in a property list. A newer program can read older formats by
// using default values for missing keyword-prefixed arguments.
class OverlayScript : public OverlayPS {
public:
OverlayScript(OverlayComp* = nil);
virtual ~OverlayScript();
virtual ClassId GetClassId();
virtual boolean IsA(ClassId);
int Indent(ostream&, int extra = 0);
// method to indent nested object output.
virtual void MinGS(ostream&);
// output a minimal description of a graphic state.
virtual void FullGS(ostream&);
// output a full description of a graphic state.
virtual void TextGS(ostream&);
// output a description of a graphic state adequate for a text graphic (TextGraphic).
virtual void StencilGS(ostream&);
// output a description of a graphic state adequate for a stencil graphic (UStencil).
boolean DefaultGS();
// return true if this is default gs, with no brush, colors, font, or pattern
// specified.
int MatchedGS(Clipboard*);
// return index of where the graphic state of this component
// matches the graphic state of a component in the clipboard.
Iterator MatchedGS(Clipboard*, int&);
// return iterator that points to where the graphic state of this component
// matches the graphic state of a component in the clipboard.
virtual boolean EmitGS(ostream&, Clipboard*, boolean);
// output a decription of this component's graphic state, and append a
// copy to a clipboard used to avoid outputting it twice.
virtual Clipboard* GetGSList();
// return pointer to clipboard of components with unique graphic states.
int MatchedPts(Clipboard*);
// return index of where the point list of this component
// matches the point list of a component in the clipboard.
Iterator MatchedPts(Clipboard*, int&);
// return iterator that points to where the point list of this component
// matches the point list of a component in the clipboard.
virtual boolean EmitPts(ostream&, Clipboard*, boolean);
// output a decription of this component's point list, and append a
// copy to a clipboard used to avoid outputting it twice.
virtual Clipboard* GetPtsList();
// return pointer to clipboard of components with unique point lists.
int MatchedPic(Clipboard*);
// return index of where the compound graphic of this component
// matches the compound graphic of a component in the clipboard.
Iterator MatchedPic(Clipboard*, int&);
// return iterator that points to where the compound graphic of this component
// matches the compound graphic of a component in the clipboard.
virtual boolean EmitPic(ostream&, Clipboard*, Clipboard*, boolean);
// output a decription of this component's compound graphic, and append a
// copy to a clipboard used to avoid outputting it twice.
virtual Clipboard* GetPicList();
// return pointer to clipboard of components with unique compound graphics.
virtual boolean GetByPathnameFlag();
// return flag that indicates whether to serialize component
// by only a pathname or by the raw data.
static int ReadGS(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// a description of graphic state.
static int ReadFillBg(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// the fill-background flag of a graphic state.
static int ReadNoneBr(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// the none-brush description.
static int ReadBrush(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// all brush descriptions except for a none-brush.
static int ReadFgColor(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// a foreground-color description.
static int ReadBgColor(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// a background-color description.
static int ReadFont(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// a font description.
static int ReadNonePat(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// the none-pattern description.
static int ReadPattern(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// all brush descriptions except for a none-pattern and gray-pattern.
static int ReadGrayPat(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// the gray-pattern description.
static int ReadTransform(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// a 6-parameter affine transform (a 2x3 matrix).
static int ReadAnnotation(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// an annotation.
static int ReadOther(istream&, void*, void*, void*, void*);
// method used by OverlayComp istream constructor to deserialize
// any keyword-prefixed argument with unknown keyword symbol, by
// adding the value to a components property list (an AttributeList).
static boolean skip_comp(istream& in);
// skip the text for the current component while de-serializing.
static boolean ptlist_parens() { return _ptlist_parens; }
// get flag that indicates putting parens around pointlist's
static void ptlist_parens(boolean flag) { _ptlist_parens = flag; }
// set flag that indicates putting parens around pointlist's
boolean svg_format();
// true if exporting SVG
void svg_format(boolean);
// set flag for exporting SVG
// can be overridden by flag associated with Command objects
static const char* format() { return _format; }
// get global format string
static void format(const char* fmt) { delete _format; _format = strnew(fmt); }
// set global format string
protected:
virtual void FillBg(ostream& out);
virtual void Brush(ostream& out);
virtual void Colors(ostream& out);
virtual void FgColor(ostream& out);
virtual void BgColor(ostream& out);
virtual void Font(ostream& out);
virtual void Pattern(ostream& out);
virtual void Transformation(ostream& out);
virtual void Transformation(ostream& out, const char* keyword, Graphic* gr = nil);
virtual void Annotation(ostream& out);
void Attributes(ostream& out);
OverlayScript* CreateOverlayScript(OverlayComp*);
virtual ComponentView* GetParent();
virtual void SetParent(ComponentView* child, ComponentView* parent);
OverlayScript* _parent;
static boolean _ptlist_parens;
static char* _format;
};
//: composite version of OverlayScript.
// a serialized view of OverlaysComp.
class OverlaysScript : public OverlayScript {
public:
OverlaysScript(OverlaysComp* = nil);
virtual ~OverlaysScript();
virtual void Update();
// construct all sub-views.
OverlaysComp* GetOverlaysComp();
// return pointer to associated component.
virtual void SetCompactions
(boolean gs = false, boolean pts = false, boolean pic=false);
// set flags to indicate what should be compacted when serialized,
// graphic state ('gs'), point lists ('pts'), or composite graphics ('pic').
virtual boolean EmitGS(ostream&, Clipboard*, boolean);
// iterate over sub-views, outputting decriptions of each unique graphic state.
virtual boolean EmitPts(ostream&, Clipboard*, boolean);
// iterate over sub-views, outputting decriptions of each unique point list.
virtual boolean EmitPic(ostream&, Clipboard*, Clipboard*, boolean);
// iterate over sub-views, outputting decriptions of each unique
// composite graphic. This is not yet fully generalized, because there are
// questions as to what that would mean.
virtual boolean Definition(ostream&);
// output variable-length ASCII record that defines the component.
static int read_name(istream&, char* buf, int bufsiz);
// static method to read the name of an object when de-serializing.
static int read_gsptspic(const char* name, istream&, OverlaysComp* comps);
// static method to read either a graphic state, a point list, or a
// compound graphic when de-serializing.
static OverlayComp* read_obj(const char* name, istream&, OverlaysComp* comps);
// static method to read an arbitrary object when de-serializing.
static int ReadChildren(istream&, void*, void*, void*, void*);
// static method to read a list of arbitrary objects when de-serializing.
static int ReadPic(istream&, void*, void*, void*, void*);
// static method to read a composite graphic id (a pic), and substitute
// the corresponding component from a list.
virtual ExternView* GetView(Iterator);
// get sub-view pointed to by the Iterator.
virtual void SetView(ExternView*, Iterator&);
// set sub-view pointed to by the Iterator.
virtual OverlayScript* GetScript(Iterator);
// get sub-view pointed to by the Iterator.
virtual void SetScript(OverlayScript*, Iterator&);
// set sub-view pointed to by the Iterator.
virtual void First(Iterator&);
// set Iterator to point to first sub-view.
virtual void Last(Iterator&);
// set Iterator to point to last sub-view.
virtual void Next(Iterator&);
// set Iterator to point to next sub-view.
virtual void Prev(Iterator&);
// set Iterator to point to prev sub-view.
virtual boolean Done(Iterator);
// return true if Iterator points off the front or end of list of sub-views.
virtual ClassId GetClassId();
virtual boolean IsA(ClassId);
protected:
UList* Elem(Iterator);
void DeleteView(Iterator&);
void DeleteViews();
UList* _views;
};
//: serialized view of top-level OverlayIdrawComp.
class OverlayIdrawScript : public OverlaysScript {
public:
OverlayIdrawScript(OverlayIdrawComp* = nil);
virtual ~OverlayIdrawScript();
virtual void SetCompactions
(boolean gs = false, boolean pts = false, boolean pic=false);
// set flags to indicate what should be compacted when serialized,
// graphic state ('gs'), point lists ('pts'), or composite graphics ('pic').
virtual void SetByPathnameFlag(boolean);
// set flag that indicates whether to serialize component
// by only a pathname or by the raw data.
virtual boolean GetByPathnameFlag();
// return flag that indicates whether to serialize component
// by only a pathname or by the raw data.
virtual boolean Emit(ostream&);
// serialize entire document to ostream.
virtual boolean EmitPic(ostream&, Clipboard*, Clipboard*, boolean);
// serialize a composite graphic.
virtual Clipboard* GetGSList();
// return pointer to list of graphic states that are stored in components.
virtual Clipboard* GetPtsList();
// return pointer to list of point lists that are stored in components.
virtual Clipboard* GetPicList();
// return pointer to list of composite graphics that are stored in components.
virtual boolean EmitSvg(ostream&);
// serialize entire document to ostream in SVG format.
virtual ClassId GetClassId();
virtual boolean IsA(ClassId);
protected:
Clipboard* _gslist;
Clipboard* _ptslist;
Clipboard* _piclist1;
Clipboard* _piclist2;
boolean _gs_compacted;
boolean _pts_compacted;
boolean _pic_compacted;
boolean _by_pathname;
};
#endif
|