41 for(std::set<Invalidator *>::iterator i =
references.begin();
65 for(std::vector<Attribute>::iterator i =
itsAttr.begin();
67 if(i->getName() ==
name)
return &(*i);
75 for(std::vector<Attribute>::const_iterator i =
itsAttr.begin();
77 if(i->getName() ==
name)
return &(*i);
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 +
"\".");
138 attr->parse(stat, eval);
142 "\" has no attribute \"" +
name +
"\".");
146 attr->parse(stat,
false);
149 throw ParseError(
"Object::parseShortcut()",
"Object \"" +
getOpalName() +
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) {
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) {
324 object =
object->itsParent;
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
std::ostream & operator<<(std::ostream &os, const Object &object)
Inform & endl(Inform &inf)
std::string parseString(Statement &, const char msg[])
Parse string value.
void parseDelimiter(Statement &stat, char delim)
Test for one-character delimiter.
double parseRealConst(Statement &)
Parse real constant.
A representation of an Object attribute.
static void addAttributeOwner(const std::string &owner, const OwnerType &type, const std::string &name)
Abstract base class for references which must be invalidated when an.
The base class for all OPAL objects.
void setParent(Object *)
Set parent object.
virtual void parseShortcut(Statement &, bool eval=true)
Parser for single-attribute commands.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
virtual Object * makeTemplate(const std::string &, TokenStream &, Statement &)
Macro handler function.
bool isFlagged() const
True, if [b]this[/b] is flagged by setFlag(true).
bool isDirty() const
True, if the [b]modified[/b] flag is set.
Object * getParent() const
Return parent pointer.
virtual void update()
Update this object.
const Object * getBaseObject() const
Return the object's base type object.
virtual Object * makeInstance(const std::string &name, Statement &, const Parser *)
Macro handler function.
const std::string & getOpalName() const
Return object name.
virtual void print(std::ostream &) const
Print the object.
Object(int size, const char *name, const char *help)
Constructor for exemplars.
int occurrenceCount()
Return the occurrence counter.
void copyAttributes(const Object &)
Copy attributes from another object.
void setDirty(bool)
Set/reset the [b]modified[/b] flag.
int increment()
Increment and return the occurrence counter.
virtual void setShared(bool)
Set/reset shared flag.
std::set< Invalidator * > references
virtual Attribute * findAttribute(const std::string &name)
Find an attribute by name.
void registerReference(Invalidator *a)
Register a reference to this object.
virtual void execute()
Execute the command.
void clear()
Clear the occurrence counter.
void setOpalName(const std::string &name)
Set object name.
virtual void printHelp(std::ostream &) const
Print help.
std::vector< Attribute > itsAttr
The object attributes.
bool isTreeMember(const Object *subTree) const
Test for tree membership.
virtual void parse(Statement &)
Parse the object.
bool isBuiltin() const
True, if [b]this[/b] is a built-in object.
virtual bool isShared() const
Shared flag.
void setFlag(bool)
Flag/unflag this object, e. g. to control output of objects for.
bool builtin
Built-in flag.
virtual void replace(Object *oldObject, Object *newObject)
Replace references.
void unregisterReference(Invalidator *a)
Unegister a reference to this object.
RCObject()
Default constructor.
Interface for abstract language parser.
Interface for statements.
void restore()
Return to marked position.
void mark()
Mark position in command.
bool word(std::string &value)
Return word value.
bool delimiter(char c)
Test for delimiter.
Abstract interface for a stream of input tokens.