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 163 const String& getKey()
const;
167 void setValue(
const String& value);
175 const String& getValue()
const;
183 Size countChildren()
const;
187 Size countDescendants()
const;
191 Size getSize()
const;
195 Size getDepth()
const;
217 bool mergeChildrenOf(
ResourceEntry& entry,
bool replace_value =
true);
225 bool removeKey(
const String& key_path);
258 bool hasChild(
const String& key)
const;
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_];
533 IteratorPosition position_;
535 Size stack_capacity_;
544 Iterator
begin() {
return Iterator::begin(*
this); }
545 Iterator
end() {
return Iterator::end(*
this); }
548 ConstIterator
begin()
const {
return ConstIterator::begin(*
this); }
549 ConstIterator
end()
const {
return ConstIterator::end(*
this); }
560 virtual void deleteEntryArray(
ResourceEntry** entry_array)
const;
568 bool findGreaterOrEqual_(
const String& key,
Index& found)
const;
574 Size number_children_;
635 virtual void clear();
646 bool open(
const String& name);
654 static void saveAs(
const Entry& entry,
const String& name);
658 void saveAs(
const String& name);
662 void save(
const Entry& entry);
675 Size getSize()
const;
683 const Entry& getRoot()
const;
687 Entry* getEntry(
const String& key_path);
691 const Entry* getEntry(
const String& key_path)
const;
703 Entry* insert(
const String& key_path,
const String& name);
707 bool removeKey(
const String& key_path);
725 bool hasKey(
const String& key_path)
const;
729 bool isEmpty()
const;
739 bool isValid()
const;
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 ResourceEntry * IteratorPosition
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
Entry::ConstIterator ConstIterator
IteratorPosition & getPosition()
ResourceEntry & getData()
ConstForwardIterator< ResourceEntry, ResourceEntry, ResourceEntry *, IteratorTraits_ > ConstIterator
ConstIterator end() const
ConstIterator begin() const
ConstIterator begin() const
ForwardIterator< ResourceEntry, ResourceEntry, ResourceEntry *, IteratorTraits_ > Iterator
const ResourceEntry & getData() const
IteratorTraits_(const IteratorTraits_ &traits, bool=true)
IteratorTraits_(const ResourceEntry &entry)
const ResourceEntry * getContainer() const
static const Index INVALID_Index
virtual ~IteratorTraits_()
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
ResourceEntry * getContainer()
const IteratorPosition & getPosition() const
BALL_EXPORT bool operator==(const String &s1, const String &s2)
#define BALL_CREATE_DEEP(name)
ConstIterator end() const