/usr/include/BALL/FORMAT/resourceFile.iC is in libball1.4-dev 1.4.3~beta1-4.
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 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: resourceFile.iC,v 1.9 2002/02/27 12:18:42 sturm Exp $
BALL_INLINE
void ResourceEntry::set(const ResourceEntry& entry, bool deep)
{
// remove old contents (including children!)
clear();
// set the new values
key_ = entry.key_;
value_ = entry.value_;
// in the case of deep copying, clone the children, too
if (deep == true)
{
ResourceEntry* cloned = (ResourceEntry *)entry.create();
mergeChildrenOf(*cloned, true);
delete cloned;
}
}
BALL_INLINE
const ResourceEntry& ResourceEntry::operator = (const ResourceEntry &entry)
{
set(entry);
return *this;
}
BALL_INLINE
void ResourceEntry::get(ResourceEntry& entry, bool deep) const
{
entry.set(*this, deep);
}
BALL_INLINE
const ResourceEntry& ResourceEntry::getRoot() const
{
return ((ResourceEntry *)this)->getRoot();
}
BALL_INLINE
ResourceEntry* ResourceEntry::getParent()
{
return parent_;
}
BALL_INLINE
const ResourceEntry* ResourceEntry::getParent() const
{
return parent_;
}
BALL_INLINE
ResourceEntry* ResourceEntry::getChild(Position index)
{
if (index < (Position)number_children_)
{
return child_[index];
}
else
{
return 0;
}
}
BALL_INLINE
const ResourceEntry* ResourceEntry::getChild(Position index) const
{
return const_cast<ResourceEntry*>(this)->getChild(index);
}
BALL_INLINE
const ResourceEntry* ResourceEntry::getEntry(const String& key_path) const
{
return const_cast<ResourceEntry*>(this)->getEntry(key_path);
}
BALL_INLINE
const String& ResourceEntry::getKey() const
{
return key_;
}
BALL_INLINE
void ResourceEntry::setValue(const String& value)
{
value_ = value;
}
BALL_INLINE
String& ResourceEntry::getValue()
{
return value_;
}
BALL_INLINE
const String& ResourceEntry::getValue() const
{
return value_;
}
BALL_INLINE
Size ResourceEntry::countChildren() const
{
return number_children_;
}
BALL_INLINE
Size ResourceEntry::getSize() const
{
return (countDescendants() + 1);
}
BALL_INLINE
ResourceEntry* ResourceEntry::insertSibling
(const String& key, const String& value, bool replace_value)
{
if (parent_ != 0) {
return parent_->insertChild(key, value, replace_value);
}
else
{
return 0;
}
}
BALL_INLINE
void ResourceEntry::destroy()
{
clear();
}
BALL_INLINE
ResourceEntry* ResourceEntry::findChild(const String& key)
{
Index found = 0;
if (number_children_ == 0 || findGreaterOrEqual_(key, found) == false)
{
return 0;
}
else
{
return child_[found];
}
}
BALL_INLINE
const ResourceEntry* ResourceEntry::findChild(const String& key) const
{
return ((ResourceEntry *)this)->findChild(key);
}
BALL_INLINE
const ResourceEntry* ResourceEntry::findDescendant(const String& key) const
{
return ((ResourceEntry *)this)->findDescendant(key);
}
BALL_INLINE
ResourceEntry* ResourceEntry::findEntry(const String& key)
{
if (key_ == key)
{
return this;
}
else
{
return findDescendant(key);
}
}
BALL_INLINE
const ResourceEntry*
ResourceEntry::findEntry(const String& key) const
{
return ((ResourceEntry *)this)->findEntry(key);
}
BALL_INLINE
void ResourceEntry::host(Visitor<ResourceEntry>& visitor)
{
visitor.visit(*this);
}
BALL_INLINE
bool ResourceEntry::hasChild(const String& key) const
{
return (findChild(key) != 0);
}
BALL_INLINE
bool ResourceEntry::isEmpty() const
{
return (number_children_ == 0);
}
BALL_INLINE
bool ResourceEntry::isParentOf(const ResourceEntry& entry) const
{
return (entry.parent_ == this);
}
BALL_INLINE
bool ResourceEntry::isChildOf(const ResourceEntry& entry) const
{
return entry.isParentOf(*this);
}
BALL_INLINE
bool ResourceEntry::isDescendantOf(const ResourceEntry& entry) const
{
return entry.isAncestorOf(*this);
}
BALL_INLINE
bool ResourceEntry::isRelatedWith(const ResourceEntry& entry) const
{
return (&entry == this || entry.isAncestorOf(*this) || this->isAncestorOf(entry));
}
BALL_INLINE
bool ResourceEntry::isRoot() const
{
return (parent_ == 0);
}
BALL_INLINE
ResourceEntry* ResourceEntry::newEntry
(const String& key, const String& value, ResourceEntry* parent) const
{
return new ResourceEntry(key, value, parent);
}
BALL_INLINE
ResourceEntry** ResourceEntry::newEntryArray(Size size) const
{
return (new ResourceEntry *[size]);
}
BALL_INLINE
void ResourceEntry::deleteEntry(ResourceEntry* entry) const
{
// if the entry is deletable, delete it
// otherwise call clear()
if ((entry != 0) && (!entry->isAutoDeletable()))
{
entry->clear();
}
else
{
delete entry;
}
}
BALL_INLINE
void ResourceEntry::deleteEntryArray(ResourceEntry** entry_array) const
{
delete [] entry_array;
}
BALL_INLINE
bool ResourceEntry::operator == (const ResourceEntry& entry) const
{
return (key_ == entry.key_ && value_ == entry.value_ &&
number_children_ == entry.number_children_);
}
BALL_INLINE
bool ResourceEntry::operator != (const ResourceEntry& entry) const
{
return !(*this == entry);
}
BALL_INLINE
void ResourceFile::close()
{
destroy();
File::close();
}
BALL_INLINE
void ResourceFile::saveAs(const String& name)
{
saveAs(root_, name);
}
BALL_INLINE
void ResourceFile::save(const Entry& entry)
{
saveAs(entry, File::getName());
}
BALL_INLINE
void ResourceFile::save()
{
saveAs(root_ ,File::getName());
}
BALL_INLINE
Size ResourceFile::getSize() const
{
return root_.getSize();
}
BALL_INLINE
ResourceFile::Entry& ResourceFile::getRoot()
{
return root_;
}
BALL_INLINE
const ResourceFile::Entry& ResourceFile::getRoot() const
{
return root_;
}
BALL_INLINE
ResourceFile::Entry* ResourceFile::getEntry(const String& key_path)
{
return root_.getEntry(key_path);
}
BALL_INLINE
const ResourceFile::Entry* ResourceFile::getEntry(const String& key_path) const
{
return root_.getEntry(key_path);
}
BALL_INLINE
String* ResourceFile::getValue(const String& key_path)
{
Entry* entry = getEntry(key_path);
if (entry == 0) {
return 0;
}
else
{
return &(entry->getValue());
}
}
BALL_INLINE
ResourceFile::Entry* ResourceFile::insert(const String& key_path, const String& name)
{
return root_.insert(key_path, name);
}
BALL_INLINE
bool ResourceFile::removeKey(const String& key_path)
{
return root_.removeKey(key_path);
}
BALL_INLINE
const String* ResourceFile::getValue(const String& key_path) const
{
return ((ResourceFile *)this)->getValue(key_path);
}
BALL_INLINE
void ResourceFile::host(Visitor<ResourceFile>& visitor)
{
visitor.visit(*this);
}
BALL_INLINE
bool ResourceFile::hasKey(const String& key_path) const
{
return (getEntry(key_path) != 0);
}
BALL_INLINE
bool ResourceFile::isEmpty() const
{
return root_.isEmpty();
}
BALL_INLINE
bool ResourceFile::isValid() const
{
return (File::isValid() && root_.isValid());
}
BALL_INLINE
bool ResourceFile::apply(UnaryProcessor<Entry>& processor)
{
return root_.apply(processor);
}
BALL_INLINE
bool ResourceFile::applyChildren(Entry& entry, UnaryProcessor<Entry>& processor)
{
return entry.applyChildren(processor);
}
BALL_INLINE
void ResourceFile::skipWhitespaces_()
{
char c;
get(c);
while(good() && isspace(c))
{
get(c);
}
putback(c);
}
BALL_INLINE
bool ResourceFile::operator == (const ResourceFile& rf) const
{
return (File::operator == (rf));
}
BALL_INLINE
bool ResourceFile::operator != (const ResourceFile& rf) const
{
return !(*this == rf);
}
|