Patch by Vasilis Kaoutsis:
* Fixed warnings * Some coding style cleanup * Added license header git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25702 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,12 +1,21 @@
|
|||||||
//----------------------------------------------------------------------
|
/*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Copyright 2002-2008, Haiku Inc. All rights reserved.
|
||||||
// by the OpenBeOS license.
|
* Distributed under the terms of the MIT License.
|
||||||
//---------------------------------------------------------------------
|
*
|
||||||
|
* Authors:
|
||||||
|
* Tyler Dauwalder, [email protected]
|
||||||
|
* Bill Hayden, [email protected]
|
||||||
|
* Erik Jakowatz
|
||||||
|
* Ingo Weinhold, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\file Path.cpp
|
\file Path.cpp
|
||||||
BPath implementation.
|
BPath implementation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
@@ -25,45 +34,54 @@ using namespace std;
|
|||||||
using namespace OpenBeOS;
|
using namespace OpenBeOS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//! Creates an uninitialized BPath object.
|
//! Creates an uninitialized BPath object.
|
||||||
BPath::BPath()
|
BPath::BPath()
|
||||||
: fName(NULL),
|
:
|
||||||
fCStatus(B_NO_INIT)
|
fName(NULL),
|
||||||
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Creates a copy of the given BPath object.
|
|
||||||
/*! \param path the object to be copied
|
/*! Creates a copy of the given BPath object.
|
||||||
|
\param path the object to be copied
|
||||||
*/
|
*/
|
||||||
BPath::BPath(const BPath &path)
|
BPath::BPath(const BPath &path)
|
||||||
: fName(NULL),
|
:
|
||||||
fCStatus(B_NO_INIT)
|
fName(NULL),
|
||||||
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
*this = path;
|
*this = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Creates a BPath object and initializes it to the filesystem entry
|
/*! \brief Creates a BPath object and initializes it to the filesystem entry
|
||||||
specified by the given entry_ref struct.
|
specified by the given entry_ref struct.
|
||||||
\param ref the entry_ref
|
\param ref the entry_ref
|
||||||
*/
|
*/
|
||||||
BPath::BPath(const entry_ref *ref)
|
BPath::BPath(const entry_ref *ref)
|
||||||
: fName(NULL),
|
:
|
||||||
fCStatus(B_NO_INIT)
|
fName(NULL),
|
||||||
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
SetTo(ref);
|
SetTo(ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Creates a BPath object and initializes it to the filesystem entry
|
/*! Creates a BPath object and initializes it to the filesystem entry
|
||||||
specified by the given BEntry object.
|
specified by the given BEntry object.
|
||||||
\param entry the BEntry object
|
\param entry the BEntry object
|
||||||
*/
|
*/
|
||||||
BPath::BPath(const BEntry *entry)
|
BPath::BPath(const BEntry *entry)
|
||||||
: fName(NULL),
|
:
|
||||||
fCStatus(B_NO_INIT)
|
fName(NULL),
|
||||||
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
SetTo(entry);
|
SetTo(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Creates a BPath object and initializes it to the specified path or
|
/*! \brief Creates a BPath object and initializes it to the specified path or
|
||||||
path and filename combination.
|
path and filename combination.
|
||||||
\param dir The base component of the pathname. May be absolute or relative.
|
\param dir The base component of the pathname. May be absolute or relative.
|
||||||
@@ -75,12 +93,14 @@ BPath::BPath(const BEntry *entry)
|
|||||||
may occur even if false (see \ref MustNormalize).
|
may occur even if false (see \ref MustNormalize).
|
||||||
*/
|
*/
|
||||||
BPath::BPath(const char *dir, const char *leaf, bool normalize)
|
BPath::BPath(const char *dir, const char *leaf, bool normalize)
|
||||||
: fName(NULL),
|
:
|
||||||
fCStatus(B_NO_INIT)
|
fName(NULL),
|
||||||
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
SetTo(dir, leaf, normalize);
|
SetTo(dir, leaf, normalize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Creates a BPath object and initializes it to the specified directory
|
/*! \brief Creates a BPath object and initializes it to the specified directory
|
||||||
and filename combination.
|
and filename combination.
|
||||||
\param dir Refers to the directory that provides the base component of the
|
\param dir Refers to the directory that provides the base component of the
|
||||||
@@ -92,20 +112,23 @@ BPath::BPath(const char *dir, const char *leaf, bool normalize)
|
|||||||
may occur even if false (see \ref MustNormalize).
|
may occur even if false (see \ref MustNormalize).
|
||||||
*/
|
*/
|
||||||
BPath::BPath(const BDirectory *dir, const char *leaf, bool normalize)
|
BPath::BPath(const BDirectory *dir, const char *leaf, bool normalize)
|
||||||
: fName(NULL),
|
:
|
||||||
fCStatus(B_NO_INIT)
|
fName(NULL),
|
||||||
|
fCStatus(B_NO_INIT)
|
||||||
{
|
{
|
||||||
SetTo(dir, leaf, normalize);
|
SetTo(dir, leaf, normalize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Destroys the BPath object and frees any of its associated resources.
|
//! Destroys the BPath object and frees any of its associated resources.
|
||||||
BPath::~BPath()
|
BPath::~BPath()
|
||||||
{
|
{
|
||||||
Unset();
|
Unset();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the status of the most recent construction or SetTo() call.
|
|
||||||
/*! \return \c B_OK, if the BPath object is properly initialized, an error
|
/*! Returns the status of the most recent construction or SetTo() call.
|
||||||
|
\return \c B_OK, if the BPath object is properly initialized, an error
|
||||||
code otherwise.
|
code otherwise.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
@@ -114,6 +137,7 @@ BPath::InitCheck() const
|
|||||||
return fCStatus;
|
return fCStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Reinitializes the object to the filesystem entry specified by the
|
/*! \brief Reinitializes the object to the filesystem entry specified by the
|
||||||
given entry_ref struct.
|
given entry_ref struct.
|
||||||
\param ref the entry_ref
|
\param ref the entry_ref
|
||||||
@@ -139,6 +163,7 @@ BPath::SetTo(const entry_ref *ref)
|
|||||||
return fCStatus;
|
return fCStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Reinitializes the object to the specified filesystem entry.
|
/*! \brief Reinitializes the object to the specified filesystem entry.
|
||||||
\param entry the BEntry
|
\param entry the BEntry
|
||||||
\return
|
\return
|
||||||
@@ -161,6 +186,7 @@ BPath::SetTo(const BEntry *entry)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Reinitializes the object to the specified path or path and file
|
/*! \brief Reinitializes the object to the specified path or path and file
|
||||||
name combination.
|
name combination.
|
||||||
\param path the path name
|
\param path the path name
|
||||||
@@ -233,6 +259,7 @@ BPath::SetTo(const char *path, const char *leaf, bool normalize)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Reinitializes the object to the specified directory and relative
|
/*! \brief Reinitializes the object to the specified directory and relative
|
||||||
path combination.
|
path combination.
|
||||||
\param dir Refers to the directory that provides the base component of the
|
\param dir Refers to the directory that provides the base component of the
|
||||||
@@ -266,6 +293,7 @@ BPath::SetTo(const BDirectory *dir, const char *path, bool normalize)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Returns the object to an uninitialized state. The object frees any
|
/*! \brief Returns the object to an uninitialized state. The object frees any
|
||||||
resources it allocated and marks itself as uninitialized.
|
resources it allocated and marks itself as uninitialized.
|
||||||
*/
|
*/
|
||||||
@@ -276,6 +304,7 @@ BPath::Unset()
|
|||||||
fCStatus = B_NO_INIT;
|
fCStatus = B_NO_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Appends the given (relative) path to the end of the current path.
|
/*! \brief Appends the given (relative) path to the end of the current path.
|
||||||
This call fails if the path is absolute or the object to which you're
|
This call fails if the path is absolute or the object to which you're
|
||||||
appending is uninitialized.
|
appending is uninitialized.
|
||||||
@@ -300,25 +329,27 @@ BPath::Append(const char *path, bool normalize)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the object's complete path name.
|
|
||||||
/*! \return
|
/*! Returns the object's complete path name.
|
||||||
|
\return
|
||||||
- the object's path name, or
|
- the object's path name, or
|
||||||
- \c NULL, if it is not properly initialized.
|
- \c NULL, if it is not properly initialized.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char*
|
||||||
BPath::Path() const
|
BPath::Path() const
|
||||||
{
|
{
|
||||||
return fName;
|
return fName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the leaf portion of the object's path name.
|
|
||||||
/*! The leaf portion is defined as the string after the last \c '/'. For
|
/*! Returns the leaf portion of the object's path name.
|
||||||
|
The leaf portion is defined as the string after the last \c '/'. For
|
||||||
the root path (\c "/") it is the empty string (\c "").
|
the root path (\c "/") it is the empty string (\c "").
|
||||||
\return
|
\return
|
||||||
- the leaf portion of the object's path name, or
|
- the leaf portion of the object's path name, or
|
||||||
- \c NULL, if it is not properly initialized.
|
- \c NULL, if it is not properly initialized.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char*
|
||||||
BPath::Leaf() const
|
BPath::Leaf() const
|
||||||
{
|
{
|
||||||
const char *result = NULL;
|
const char *result = NULL;
|
||||||
@@ -334,6 +365,7 @@ BPath::Leaf() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Calls the argument's SetTo() method with the name of the
|
/*! \brief Calls the argument's SetTo() method with the name of the
|
||||||
object's parent directory.
|
object's parent directory.
|
||||||
No normalization is done.
|
No normalization is done.
|
||||||
@@ -370,8 +402,9 @@ BPath::GetParent(BPath *path) const
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Performs a simple (string-wise) comparison of paths.
|
|
||||||
/*! No normalization takes place! Uninitialized BPath objects are considered
|
/*! Performs a simple (string-wise) comparison of paths.
|
||||||
|
No normalization takes place! Uninitialized BPath objects are considered
|
||||||
to be equal.
|
to be equal.
|
||||||
\param item the BPath object to be compared with
|
\param item the BPath object to be compared with
|
||||||
\return \c true, if the path names are equal, \c false otherwise.
|
\return \c true, if the path names are equal, \c false otherwise.
|
||||||
@@ -382,20 +415,22 @@ BPath::operator==(const BPath &item) const
|
|||||||
return (*this == item.Path());
|
return (*this == item.Path());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Performs a simple (string-wise) comparison of paths.
|
|
||||||
/*! No normalization takes place!
|
/*! Performs a simple (string-wise) comparison of paths.
|
||||||
|
No normalization takes place!
|
||||||
\param path the path name to be compared with
|
\param path the path name to be compared with
|
||||||
\return \c true, if the path names are equal, \c false otherwise.
|
\return \c true, if the path names are equal, \c false otherwise.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
BPath::operator==(const char *path) const
|
BPath::operator==(const char *path) const
|
||||||
{
|
{
|
||||||
return (InitCheck() != B_OK && path == NULL
|
return ((InitCheck() != B_OK && (path == NULL))
|
||||||
|| fName && path && strcmp(fName, path) == 0);
|
|| ((fName && path) && strcmp(fName, path)) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Performs a simple (string-wise) comparison of paths.
|
|
||||||
/*! No normalization takes place! Uninitialized BPath objects are considered
|
/*! Performs a simple (string-wise) comparison of paths.
|
||||||
|
No normalization takes place! Uninitialized BPath objects are considered
|
||||||
to be equal.
|
to be equal.
|
||||||
\param item the BPath object to be compared with
|
\param item the BPath object to be compared with
|
||||||
\return \c true, if the path names are not equal, \c false otherwise.
|
\return \c true, if the path names are not equal, \c false otherwise.
|
||||||
@@ -406,8 +441,9 @@ BPath::operator!=(const BPath &item) const
|
|||||||
return !(*this == item);
|
return !(*this == item);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Performs a simple (string-wise) comparison of paths.
|
|
||||||
/*! No normalization takes place!
|
/*! Performs a simple (string-wise) comparison of paths.
|
||||||
|
No normalization takes place!
|
||||||
\param path the path name to be compared with
|
\param path the path name to be compared with
|
||||||
\return \c true, if the path names are not equal, \c false otherwise.
|
\return \c true, if the path names are not equal, \c false otherwise.
|
||||||
*/
|
*/
|
||||||
@@ -417,8 +453,9 @@ BPath::operator!=(const char *path) const
|
|||||||
return !(*this == path);
|
return !(*this == path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Initializes the object to be a copy of the argument.
|
|
||||||
/*! \param item the BPath object to be copied
|
/*! Initializes the object to be a copy of the argument.
|
||||||
|
\param item the BPath object to be copied
|
||||||
\return \c *this
|
\return \c *this
|
||||||
*/
|
*/
|
||||||
BPath&
|
BPath&
|
||||||
@@ -429,8 +466,9 @@ BPath::operator=(const BPath &item)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Initializes the object to be a copy of the argument.
|
|
||||||
/*! Has the same effect as \code SetTo(path) \endcode.
|
/*! Initializes the object to be a copy of the argument.
|
||||||
|
Has the same effect as \code SetTo(path) \endcode.
|
||||||
\param path the path name to be assigned to this object
|
\param path the path name to be assigned to this object
|
||||||
\return \c *this
|
\return \c *this
|
||||||
*/
|
*/
|
||||||
@@ -459,8 +497,8 @@ static const size_t flattened_entry_ref_size
|
|||||||
= sizeof(dev_t) + sizeof(ino_t);
|
= sizeof(dev_t) + sizeof(ino_t);
|
||||||
|
|
||||||
|
|
||||||
//! Returns \c false.
|
/*! Returns \c false.
|
||||||
/*! Implements BFlattenable.
|
Implements BFlattenable.
|
||||||
\return \c false
|
\return \c false
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
@@ -469,8 +507,9 @@ BPath::IsFixedSize() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns \c B_REF_TYPE.
|
|
||||||
/*! Implements BFlattenable.
|
/*! Returns \c B_REF_TYPE.
|
||||||
|
Implements BFlattenable.
|
||||||
\return \c B_REF_TYPE
|
\return \c B_REF_TYPE
|
||||||
*/
|
*/
|
||||||
type_code
|
type_code
|
||||||
@@ -479,6 +518,7 @@ BPath::TypeCode() const
|
|||||||
return B_REF_TYPE;
|
return B_REF_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Returns the size of the flattened entry_ref structure that
|
/*! \brief Returns the size of the flattened entry_ref structure that
|
||||||
represents the pathname.
|
represents the pathname.
|
||||||
Implements BFlattenable.
|
Implements BFlattenable.
|
||||||
@@ -498,6 +538,7 @@ BPath::FlattenedSize() const
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Converts the object's pathname to an entry_ref and writes it into
|
/*! \brief Converts the object's pathname to an entry_ref and writes it into
|
||||||
buffer.
|
buffer.
|
||||||
Implements BFlattenable.
|
Implements BFlattenable.
|
||||||
@@ -536,8 +577,9 @@ BPath::Flatten(void *buffer, ssize_t size) const
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns \c true if code is \c B_REF_TYPE, and false otherwise.
|
|
||||||
/*! Implements BFlattenable.
|
/*! Returns \c true if code is \c B_REF_TYPE, and false otherwise.
|
||||||
|
Implements BFlattenable.
|
||||||
\param code the type code in question
|
\param code the type code in question
|
||||||
\return \c true if code is \c B_REF_TYPE, and false otherwise.
|
\return \c true if code is \c B_REF_TYPE, and false otherwise.
|
||||||
*/
|
*/
|
||||||
@@ -547,6 +589,7 @@ BPath::AllowsTypeCode(type_code code) const
|
|||||||
return (code == B_REF_TYPE);
|
return (code == B_REF_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Initializes the BPath with the flattened entry_ref data that's
|
/*! \brief Initializes the BPath with the flattened entry_ref data that's
|
||||||
found in the supplied buffer.
|
found in the supplied buffer.
|
||||||
The type code must be \c B_REF_TYPE.
|
The type code must be \c B_REF_TYPE.
|
||||||
@@ -586,10 +629,12 @@ BPath::Unflatten(type_code code, const void *buf, ssize_t size)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BPath::_WarPath1() {}
|
void BPath::_WarPath1() {}
|
||||||
void BPath::_WarPath2() {}
|
void BPath::_WarPath2() {}
|
||||||
void BPath::_WarPath3() {}
|
void BPath::_WarPath3() {}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Sets the supplied path.
|
/*! \brief Sets the supplied path.
|
||||||
The path is copied. If \c NULL, the object's path is set to NULL as well.
|
The path is copied. If \c NULL, the object's path is set to NULL as well.
|
||||||
The object's old path is deleted.
|
The object's old path is deleted.
|
||||||
@@ -618,7 +663,6 @@ BPath::set_path(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Checks a path to see if normalization is required.
|
/*! \brief Checks a path to see if normalization is required.
|
||||||
|
|
||||||
The following items require normalization:
|
The following items require normalization:
|
||||||
@@ -719,6 +763,3 @@ BPath::MustNormalize(const char *path)
|
|||||||
\var status_t BPath::fCStatus
|
\var status_t BPath::fCStatus
|
||||||
\brief The object's initialization status.
|
\brief The object's initialization status.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,40 +1,47 @@
|
|||||||
//----------------------------------------------------------------------
|
/*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Copyright 2002-2008, Haiku Inc. All rights reserved.
|
||||||
// by the OpenBeOS license.
|
* Distributed under the terms of the MIT License.
|
||||||
//---------------------------------------------------------------------
|
*
|
||||||
|
* Authors:
|
||||||
|
* Tyler Dauwalder, [email protected]
|
||||||
|
* Erik Jakowatz
|
||||||
|
* Ingo Weinhold, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\file ResourcesContainer.cpp
|
\file ResourcesContainer.cpp
|
||||||
ResourcesContainer implementation.
|
ResourcesContainer implementation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "ResourcesContainer.h"
|
#include "ResourcesContainer.h"
|
||||||
|
|
||||||
#include "ResourceItem.h"
|
#include "ResourceItem.h"
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
namespace Storage {
|
namespace Storage {
|
||||||
|
|
||||||
// constructor
|
|
||||||
ResourcesContainer::ResourcesContainer()
|
ResourcesContainer::ResourcesContainer()
|
||||||
: fResources(),
|
:
|
||||||
fIsModified(false)
|
fResources(),
|
||||||
|
fIsModified(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
ResourcesContainer::~ResourcesContainer()
|
ResourcesContainer::~ResourcesContainer()
|
||||||
{
|
{
|
||||||
MakeEmpty();
|
MakeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddResource
|
|
||||||
//
|
//! Returns false, if item is NULL or memory is insufficient, true otherwise.
|
||||||
// Returns false, if item is NULL or memory is insufficient, true otherwise.
|
|
||||||
bool
|
bool
|
||||||
ResourcesContainer::AddResource(ResourceItem *item, int32 index,
|
ResourcesContainer::AddResource(ResourceItem *item, int32 index, bool replace)
|
||||||
bool replace)
|
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (item) {
|
if (item) {
|
||||||
@@ -50,7 +57,7 @@ ResourcesContainer::AddResource(ResourceItem *item, int32 index,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveResource
|
|
||||||
ResourceItem*
|
ResourceItem*
|
||||||
ResourcesContainer::RemoveResource(int32 index)
|
ResourcesContainer::RemoveResource(int32 index)
|
||||||
{
|
{
|
||||||
@@ -60,14 +67,14 @@ ResourcesContainer::RemoveResource(int32 index)
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveResource
|
|
||||||
bool
|
bool
|
||||||
ResourcesContainer::RemoveResource(ResourceItem *item)
|
ResourcesContainer::RemoveResource(ResourceItem *item)
|
||||||
{
|
{
|
||||||
return RemoveResource(IndexOf(item));
|
return RemoveResource(IndexOf(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeEmpty
|
|
||||||
void
|
void
|
||||||
ResourcesContainer::MakeEmpty()
|
ResourcesContainer::MakeEmpty()
|
||||||
{
|
{
|
||||||
@@ -77,7 +84,7 @@ ResourcesContainer::MakeEmpty()
|
|||||||
SetModified(false);
|
SetModified(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssimilateResources
|
|
||||||
void
|
void
|
||||||
ResourcesContainer::AssimilateResources(ResourcesContainer &container)
|
ResourcesContainer::AssimilateResources(ResourcesContainer &container)
|
||||||
{
|
{
|
||||||
@@ -98,14 +105,14 @@ ResourcesContainer::AssimilateResources(ResourcesContainer &container)
|
|||||||
SetModified(true);
|
SetModified(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexOf
|
|
||||||
int32
|
int32
|
||||||
ResourcesContainer::IndexOf(ResourceItem *item) const
|
ResourcesContainer::IndexOf(ResourceItem *item) const
|
||||||
{
|
{
|
||||||
return fResources.IndexOf(item);
|
return fResources.IndexOf(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexOf
|
|
||||||
int32
|
int32
|
||||||
ResourcesContainer::IndexOf(const void *data) const
|
ResourcesContainer::IndexOf(const void *data) const
|
||||||
{
|
{
|
||||||
@@ -120,7 +127,7 @@ ResourcesContainer::IndexOf(const void *data) const
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexOf
|
|
||||||
int32
|
int32
|
||||||
ResourcesContainer::IndexOf(type_code type, int32 id) const
|
ResourcesContainer::IndexOf(type_code type, int32 id) const
|
||||||
{
|
{
|
||||||
@@ -134,7 +141,7 @@ ResourcesContainer::IndexOf(type_code type, int32 id) const
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexOf
|
|
||||||
int32
|
int32
|
||||||
ResourcesContainer::IndexOf(type_code type, const char *name) const
|
ResourcesContainer::IndexOf(type_code type, const char *name) const
|
||||||
{
|
{
|
||||||
@@ -143,16 +150,17 @@ ResourcesContainer::IndexOf(type_code type, const char *name) const
|
|||||||
for (int32 i = 0; index == -1 && i < count; i++) {
|
for (int32 i = 0; index == -1 && i < count; i++) {
|
||||||
ResourceItem *item = ResourceAt(i);
|
ResourceItem *item = ResourceAt(i);
|
||||||
const char *itemName = item->Name();
|
const char *itemName = item->Name();
|
||||||
if (item->Type() == type && (name == NULL && itemName == NULL
|
if (item->Type() == type
|
||||||
|| name != NULL && itemName != NULL
|
&& (((name == NULL && itemName == NULL)
|
||||||
&& !strcmp(name, itemName))) {
|
|| (name != NULL && itemName != NULL))
|
||||||
|
&& !strcmp(name, itemName))) {
|
||||||
index = i;
|
index = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexOfType
|
|
||||||
int32
|
int32
|
||||||
ResourcesContainer::IndexOfType(type_code type, int32 typeIndex) const
|
ResourcesContainer::IndexOfType(type_code type, int32 typeIndex) const
|
||||||
{
|
{
|
||||||
@@ -169,21 +177,21 @@ ResourcesContainer::IndexOfType(type_code type, int32 typeIndex) const
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceAt
|
|
||||||
ResourceItem*
|
ResourceItem*
|
||||||
ResourcesContainer::ResourceAt(int32 index) const
|
ResourcesContainer::ResourceAt(int32 index) const
|
||||||
{
|
{
|
||||||
return (ResourceItem*)fResources.ItemAt(index);
|
return (ResourceItem*)fResources.ItemAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CountResources
|
|
||||||
int32
|
int32
|
||||||
ResourcesContainer::CountResources() const
|
ResourcesContainer::CountResources() const
|
||||||
{
|
{
|
||||||
return fResources.CountItems();
|
return fResources.CountItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetModified
|
|
||||||
void
|
void
|
||||||
ResourcesContainer::SetModified(bool modified)
|
ResourcesContainer::SetModified(bool modified)
|
||||||
{
|
{
|
||||||
@@ -196,7 +204,7 @@ ResourcesContainer::SetModified(bool modified)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsModified
|
|
||||||
bool
|
bool
|
||||||
ResourcesContainer::IsModified() const
|
ResourcesContainer::IsModified() const
|
||||||
{
|
{
|
||||||
@@ -210,7 +218,3 @@ ResourcesContainer::IsModified() const
|
|||||||
|
|
||||||
}; // namespace Storage
|
}; // namespace Storage
|
||||||
}; // namespace BPrivate
|
}; // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user