Small code cleaning. Additional check for proper values in substring method.

git-svn-id: http://svn.code.sf.net/p/irrlicht/code/trunk@1415 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
hybrid 2008-07-17 09:01:06 +00:00
parent 3ecc64ead9
commit ef06f6ef9b
8 changed files with 33 additions and 52 deletions

View File

@ -16,10 +16,6 @@ namespace io
class IFileList : public virtual IReferenceCounted
{
public:
//! Destructor
virtual ~IFileList() {}
//! Get the number of files in the filelist.
/** \return Amount of files and directories in the file list. */
virtual u32 getFileCount() const = 0;
@ -37,11 +33,10 @@ public:
\return File name of the file. Returns 0, if an error occured. */
virtual const c8* getFullFileName(u32 index) = 0;
//! Returns of the file is a directory
/** \param index is the zero based index of the file which name should
//! Check if the file is a directory
/** \param index The zero based index of the file whose name shall
be returned. The index has to be smaller than the amount getFileCount() returns.
\return True, if the file is a directory, and false, if it is not.
If an error occurs, the result is undefined. */
\return True if the file is a directory, else false. */
virtual bool isDirectory(u32 index) const = 0;
};

View File

@ -32,9 +32,6 @@ class IFileSystem : public virtual IReferenceCounted
{
public:
//! Destructor
virtual ~IFileSystem() {}
//! Opens a file for read access.
/** \param filename: Name of file to open.
\return Returns a pointer to the created file interface.
@ -189,7 +186,7 @@ public:
//! Creates a new empty collection of attributes, usable for serialization and more.
/** \param driver: Video driver to be used to load textures when specified as attribute values.
Can be null to prevent automatic texture loading by attributes.
\return Returns a pointer to the created object.
\return Pointer to the created object.
If you no longer need the object, you should call IAttributes::drop().
See IReferenceCounted::drop() for more information. */
virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) = 0;

View File

@ -223,7 +223,6 @@ public:
parentAbsoluteClip = Parent->AbsoluteClippingRect;
}
diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
@ -233,7 +232,6 @@ public:
if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE)
fh = (f32)parentAbsolute.getHeight();
switch (AlignLeft)
{
case EGUIA_UPPERLEFT:
@ -296,8 +294,8 @@ public:
RelativeRect = DesiredRect;
s32 w = RelativeRect.getWidth();
s32 h = RelativeRect.getHeight();
const s32 w = RelativeRect.getWidth();
const s32 h = RelativeRect.getHeight();
// make sure the desired rectangle is allowed
if (w < MinSize.Width)

View File

@ -16,18 +16,15 @@ namespace io
class IReadFile : public virtual IReferenceCounted
{
public:
//! Destructor
virtual ~IReadFile() {}
//! Reads an amount of bytes from the file.
/** \param buffer Pointer to buffer where to read bytes will be written to.
/** \param buffer Pointer to buffer where read bytes are written to.
\param sizeToRead Amount of bytes to read from the file.
\return How much bytes were read. */
virtual s32 read(void* buffer, u32 sizeToRead) = 0;
//! Changes position in file
/** \param finalPos: Destination position in the file.
\param relativeMovement: If set to true, the position in the file is
/** \param finalPos Destination position in the file.
\param relativeMovement If set to true, the position in the file is
changed relative to current position. Otherwise the position is changed
from beginning of file.
\return True if successful, otherwise false. */

View File

@ -16,9 +16,6 @@ namespace io
class IWriteFile : public virtual IReferenceCounted
{
public:
//! Destructor
virtual ~IWriteFile() {}
//! Writes an amount of bytes to the file.
/** \param buffer Pointer to buffer of bytes to write.
\param sizeToWrite Amount of bytes to write to the file.

View File

@ -26,8 +26,6 @@ class map
: LeftChild(0), RightChild(0), Parent(0), Key(k),
Value(v), IsRed(true) {}
~RBTree() {}
void setLeftChild(RBTree* p)
{
LeftChild=p;
@ -280,10 +278,10 @@ class map
//! Parent First Iterator.
//! Traverses the tree from top to bottom. Typical usage is
//! when storing the tree structure, because when reading it
//! later (and inserting elements) the tree structure will
//! be the same.
/** Traverses the tree from top to bottom. Typical usage is
when storing the tree structure, because when reading it
later (and inserting elements) the tree structure will
be the same. */
class ParentFirstIterator
{
public:
@ -388,10 +386,10 @@ class map
//! Parent Last Iterator
//! Traverse the tree from bottom to top.
//! Typical usage is when deleting all elements in the tree
//! because you must delete the children before you delete
//! their parent.
/** Traverse the tree from bottom to top.
Typical usage is when deleting all elements in the tree
because you must delete the children before you delete
their parent. */
class ParentLastIterator
{
public:
@ -475,7 +473,6 @@ class map
Cur = Cur->getParent();
}
Node* Root;
Node* Cur;
}; // ParentLastIterator
@ -539,10 +536,9 @@ class map
//------------------------------
//! Inserts a new node into the tree
//! \param keyNew: the index for this value
//! \param v: the value to insert
//! \return Returns true if successful,
//! false if it fails (already exists)
/** \param keyNew: the index for this value
\param v: the value to insert
\return True if successful, false if it fails (already exists) */
bool insert(const KeyType& keyNew, const ValueType& v)
{
// First insert node the "usual" way (no fancy balance logic yet)
@ -622,10 +618,9 @@ class map
return true;
}
//! Replaces the value if the key already exists,
//! otherwise inserts a new element.
//! \param k: the index for this value
//! \param v: the new value of
//! Replaces the value if the key already exists, otherwise inserts a new element.
/** \param k The index for this value
\param v The new value of */
void set(const KeyType& k, const ValueType& v)
{
Node* p = find(k);
@ -636,9 +631,9 @@ class map
}
//! Removes a node from the tree and returns it.
//! The returned node must be deleted by the user
//! \param k: the key to remove
//! \return: A pointer to the node, or 0 if not found
/** The returned node must be deleted by the user
\param k the key to remove
\return A pointer to the node, or 0 if not found */
Node* delink(const KeyType& k)
{
Node* p = find(k);
@ -677,7 +672,7 @@ class map
}
//! Removes a node from the tree and deletes it.
//! \return True if the node was found and deleted
/** \return True if the node was found and deleted */
bool remove(const KeyType& k)
{
Node* p = find(k);
@ -916,7 +911,6 @@ class map
//! Pull up node's left child and let it knock node down to the right
void rotateRight(Node* p)
{
Node* left = p->getLeftChild();
p->setLeftChild(left->getRightChild());

View File

@ -713,10 +713,13 @@ public:
//! \param length: Length of substring.
string<T> subString(u32 begin, s32 length) const
{
// if start after string
// or no proper substring length
if ((length <= 0) || (begin>=size()))
return string<T>("");
// clamp length to maximal value
if ((length+begin) > size())
length = size()-begin;
if (length <= 0)
return string<T>("");
string<T> o;
o.reserve(length+1);

View File

@ -217,7 +217,7 @@ public:
\return True if this vector is between begin and end, false if not. */
bool isBetweenPoints(const vector2d<T>& begin, const vector2d<T>& end) const
{
T f = (end - begin).getLengthSQ();
const T f = (end - begin).getLengthSQ();
return getDistanceFromSQ(begin) < f &&
getDistanceFromSQ(end) < f;
}