67 if(i->getName() ==
name)
return &(*i);
75 for(std::vector<Attribute>::const_iterator i =
itsAttr.begin();
77 if(i->getName() ==
name)
return &(*i);
86 throw ParseError(
"Object::makeTemplate()",
"Object \"" + name +
87 "\" cannot be used to define a macro.");
93 "\" cannot be called as a macro.");
107 attr->parseComponent(stat,
true, index);
109 attr->parseComponent(stat,
false, index);
112 "Delimiter \"=\" or \":=\" expected.");
115 attr->parse(stat,
true);
117 attr->parse(stat,
false);
123 "\" has no attribute \"" + name +
"\".");
135 if(stat.
word(name)) {
138 attr->parse(stat, eval);
142 "\" has no attribute \"" + name +
"\".");
146 attr->parse(stat,
false);
150 "\" has no attribute \"" + name +
"\".");
164 if(parent != 0 && ! parent->
getOpalName().empty()) {
170 int pos = head.length();
172 for(std::vector<Attribute>::const_iterator i =
itsAttr.begin();
174 if(*i) i->print(pos);
196 for (
unsigned int i = 0; i <
end; ++ i) {
205 *gmsg <<
"Attributes:" <<
endl;
207 size_t maxNameLength = 16;
208 size_t maxTypeLength = 16;
209 std::vector<Attribute>::const_iterator
it;
211 std::string name = it->getName();
212 maxNameLength =
std::max(maxNameLength, name.length() + 1);
213 std::string
type = it->getType();
214 maxTypeLength =
std::max(maxTypeLength, type.length() + 1);
218 std::string
type = it->getType();
219 std::string name = it->getName();
220 std::istringstream help(it->getHelp());
221 std::vector<std::string> words;
222 std::copy(std::istream_iterator<std::string>(help),
223 std::istream_iterator<std::string>(),
224 std::back_inserter(words));
225 unsigned int columnWidth = 40;
226 if (maxNameLength + maxTypeLength < 40u) {
227 columnWidth = 80 - maxNameLength - maxTypeLength;
230 auto wordsIt = words.begin();
231 auto wordsEnd = words.end();
232 while (wordsIt != wordsEnd) {
233 *gmsg <<
'\t' << type << std::string(maxTypeLength - type.length(),
' ');
234 *gmsg << name << std::string(maxNameLength - name.length(),
' ');
235 unsigned int totalLength = 0;
237 totalLength += wordsIt->length();
238 *gmsg << *wordsIt <<
" ";
240 }
while (wordsIt != wordsEnd && totalLength + wordsIt->length() < columnWidth);
241 if (wordsIt != wordsEnd) {
249 if(it->isReadOnly()) *gmsg <<
" (read only)";
304 const Object *base =
this;
321 const Object *
object =
this;
323 while(
object != 0 &&
object != classObject) {
357 RCObject(), itsAttr(size), itsParent(0),
358 itsName(name), itsHelp(help), occurrence(0), sharedFlag(false) {
369 RCObject(), itsAttr(parent->itsAttr), itsParent(parent),
370 itsName(name), itsHelp(parent->itsHelp), occurrence(0), sharedFlag(false) {
virtual void execute()
Execute the command.
void registerReference(Invalidator *a)
Register a reference to this object.
virtual void parse(Statement &)
Parse the object.
bool builtin
Built-in flag.
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a copy
Abstract base class for reference counted objects.
void setOpalName(const std::string &name)
Set object name.
The base class for all OPAL objects.
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
void setFlag(bool)
Flag/unflag this object, e. g. to control output of objects for.
virtual Object * makeTemplate(const std::string &, TokenStream &, Statement &)
Macro handler function.
void copyAttributes(const Object &)
Copy attributes from another object.
void parseDelimiter(Statement &stat, char delim)
Test for one-character delimiter.
bool isBuiltin() const
True, if [b]this[/b] is a built-in object.
virtual void printHelp(std::ostream &) const
Print help.
std::ostream & operator<<(std::ostream &os, const Attribute &attr)
void setParent(Object *)
Set parent object.
void unregisterReference(Invalidator *a)
Unegister a reference to this object.
void mark()
Mark position in command.
void restore()
Return to marked position.
virtual void update()
Update this object.
virtual void replace(Object *oldObject, Object *newObject)
Replace references.
Inform & endl(Inform &inf)
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
std::string::iterator iterator
bool isDirty() const
True, if the [b]modified[/b] flag is set.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
bool isFlagged() const
True, if [b]this[/b] is flagged by setFlag(true).
Abstract interface for a stream of input tokens.
virtual void setShared(bool)
Set/reset shared flag.
virtual void parseShortcut(Statement &, bool eval=true)
Parser for single-attribute commands.
Object * getParent() const
Return parent pointer.
int occurrenceCount()
Return the occurrence counter.
bool word(std::string &value)
Return word value.
Interface for statements.
std::set< Invalidator * > references
bool delimiter(char c)
Test for delimiter.
std::string parseString(Statement &, const char msg[])
Parse string value.
const std::string & getOpalName() const
Return object name.
std::vector< Attribute > itsAttr
The object attributes.
virtual Object * makeInstance(const std::string &name, Statement &, const Parser *)
Macro handler function.
Abstract base class for references which must be invalidated when an.
virtual void print(std::ostream &) const
Print the object.
double parseRealConst(Statement &)
Parse real constant.
virtual bool isShared() const
Shared flag.
bool isTreeMember(const Object *subTree) const
Test for tree membership.
virtual Attribute * findAttribute(const std::string &name)
Find an attribute by name.
const Object * getBaseObject() const
Return the object's base type object.
void setDirty(bool)
Set/reset the [b]modified[/b] flag.
Interface for abstract language parser.
int increment()
Increment and return the occurrence counter.
void clear()
Clear the occurrence counter.
static void addAttributeOwner(const std::string &owner, const OwnerType &type, const std::string &name)
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
A representation of an Object attribute.