Go to the documentation of this file.
5 #ifndef BALL_FORMAT_RESOURCEFILE_H
6 #define BALL_FORMAT_RESOURCEFILE_H
12 #ifndef BALL_CONCEPT_FORWARDITERATOR_H
16 #ifndef BALL_CONCEPT_VISITOR_H
20 #ifndef BALL_CONCEPT_AUTODELETABLE_H
24 #ifndef BALL_CONCEPT_PROCESSOR_H
28 #ifndef BALL_SYSTEM_FILE_H
262 bool isEmpty() const;
295 bool isValid() const;
298 void dump(std::ostream& s = std::cout,
Size depth = 0) const;
330 stack_index_(new
Index[1]),
339 stack_index_(new
Index[1]),
346 : bound_(traits.bound_),
347 position_(traits.position_),
348 stack_index_(new
Index[traits.stack_capacity_]),
349 stack_capacity_(traits.stack_capacity_),
350 stack_size_(traits.stack_size_)
352 for (
Index index = 0; index < (
Index)stack_capacity_; ++index)
353 stack_index_[index] = traits.stack_index_[index];
358 delete[] stack_index_;
363 bound_ = traits.bound_;
364 position_ = traits.position_;
365 delete[] stack_index_;
366 stack_index_ =
new Index[traits.stack_capacity_];
367 stack_capacity_ = traits.stack_capacity_;
368 stack_size_ = traits.stack_size_;
370 for (
Index index = 0; index < (
Index)stack_capacity_; ++index)
372 stack_index_[index] = traits.stack_index_[index];
390 return (bound_ == 0);
405 return (position_ == traits.position_);
410 return (position_ != traits.position_);
415 return (bound_ != 0 && position_ != 0
417 && stack_size_ <= stack_capacity_
418 && stack_capacity_ > 0);
436 return (position_ == bound_);
446 return (position_ == 0);
461 if (position_->number_children_ > 0)
463 position_ = position_->child_[0];
481 position_ = position_->parent_;
484 }
while(++next_child >= (
Index)position_->number_children_);
487 position_ = position_->child_[next_child];
499 void push(
Index next_child)
501 if (stack_size_ >= stack_capacity_)
503 Index *new_stack_index =
new Index[stack_capacity_ << 1];
505 for (
Index index = 0; index < (
Index)stack_capacity_; ++index)
507 new_stack_index[index] = stack_index_[index];
510 delete[] stack_index_;
511 stack_index_ = new_stack_index;
512 stack_capacity_ <<= 1;
515 stack_index_[stack_size_] = next_child;
522 if (stack_size_ == 0)
528 return stack_index_[--stack_size_];
532 ResourceEntry* bound_;
533 IteratorPosition position_;
535 Size stack_capacity_;
568 bool findGreaterOrEqual_(
const String& key,
Index& found)
const;
574 Size number_children_;
743 void dump(std::ostream& s = std::cout,
Size depth = 0)
const;
777 return Iterator::begin(root_);
782 return Iterator::end(root_);
790 return ConstIterator::begin(root_);
795 return ConstIterator::end(root_);
803 static void save_(
File& file,
const Entry* entry,
Size& depth);
805 bool validateSyntax_();
807 void skipWhitespaces_();
812 # ifndef BALL_NO_INLINE_FUNCTIONS
813 # include <BALL/FORMAT/resourceFile.iC>
817 #endif // BALL_FORMAT_RESOURCEFILE_H
IteratorPosition & getPosition()
ConstIterator end() const
const IteratorPosition & getPosition() const
const ResourceEntry * getContainer() const
static bool applyChildren(Entry &entry, UnaryProcessor< Entry > &processor)
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
bool open(const String &name)
virtual void deleteEntryArray(ResourceEntry **entry_array) const
bool applyNostart_(UnaryProcessor< ResourceEntry > &processor)
const Entry & getRoot() const
ConstForwardIterator< ResourceEntry, ResourceEntry, ResourceEntry *, IteratorTraits_ > ConstIterator
const Entry * getEntry(const String &key_path) const
const ResourceEntry & getData() const
void host(Visitor< ResourceFile > &visitor)
#define BALL_CREATE_DEEP(name)
IteratorTraits_(const IteratorTraits_ &traits, bool=true)
Entry * insert(const String &key_path, const String &name)
static void saveAs(const Entry &entry, const String &name)
ResourceEntry & getData()
IteratorTraits_(const ResourceEntry &entry)
ForwardIterator< ResourceEntry, ResourceEntry, ResourceEntry *, IteratorTraits_ > Iterator
ConstIterator begin() const
Entry::ConstIterator ConstIterator
virtual ResourceEntry * newEntry(const String &key, const String &value, ResourceEntry *parent=0) const
virtual ~IteratorTraits_()
virtual void deleteEntry(ResourceEntry *entry) const
bool hasKey(const String &key_path) const
void saveAs(const String &name)
ResourceFile(const String &name)
void save(const Entry &entry)
bool removeKey(const String &key_path)
Entry * getEntry(const String &key_path)
ResourceEntry * getContainer()
BALL_EXPORT bool operator==(const String &s1, const String &s2)
static const Index INVALID_Index
bool apply(UnaryProcessor< Entry > &processor)
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
String * getValue(const String &key_path)
void dump(std::ostream &s=std::cout, Size depth=0) const
ConstIterator begin() const
virtual ResourceEntry ** newEntryArray(Size size) const
ConstIterator end() const
const String * getValue(const String &key_path) const