* Cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35102 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-01-16 16:45:27 +00:00
parent e45d83a9c8
commit 133da790ea
+34 -34
View File
@@ -1,12 +1,18 @@
//---------------------------------------------------------------------- /*
// This software is part of the Haiku distribution and is covered * Copyright 2002-2009, Haiku Inc.
// by the MIT license. * Distributed under the terms of the MIT License.
//--------------------------------------------------------------------- *
/*! * Authors:
\file SymLink.cpp * Tyler Dauwalder
* Ingo Weinhold, [email protected]
*/
/*! \file SymLink.cpp
BSymLink implementation. BSymLink implementation.
*/ */
#include <new> #include <new>
#include <string.h> #include <string.h>
@@ -21,37 +27,34 @@
using namespace std; using namespace std;
#ifdef USE_OPENBEOS_NAMESPACE
namespace OpenBeOS {
#endif
// constructor
//! Creates an uninitialized BSymLink object. //! Creates an uninitialized BSymLink object.
BSymLink::BSymLink() BSymLink::BSymLink()
: BNode()
{ {
} }
// copy constructor
//! Creates a copy of the supplied BSymLink. //! Creates a copy of the supplied BSymLink.
/*! \param link the BSymLink object to be copied /*! \param link the BSymLink object to be copied
*/ */
BSymLink::BSymLink(const BSymLink &link) BSymLink::BSymLink(const BSymLink &link)
: BNode(link) :
BNode(link)
{ {
} }
// constructor
/*! \brief Creates a BSymLink and initializes it to the symbolic link referred /*! \brief Creates a BSymLink and initializes it to the symbolic link referred
to by the supplied entry_ref. to by the supplied entry_ref.
\param ref the entry_ref referring to the symbolic link \param ref the entry_ref referring to the symbolic link
*/ */
BSymLink::BSymLink(const entry_ref *ref) BSymLink::BSymLink(const entry_ref *ref)
: BNode(ref) :
BNode(ref)
{ {
} }
// constructor
/*! \brief Creates a BSymLink and initializes it to the symbolic link referred /*! \brief Creates a BSymLink and initializes it to the symbolic link referred
to by the supplied BEntry. to by the supplied BEntry.
\param entry the BEntry referring to the symbolic link \param entry the BEntry referring to the symbolic link
@@ -61,17 +64,18 @@ BSymLink::BSymLink(const BEntry *entry)
{ {
} }
// constructor
/*! \brief Creates a BSymLink and initializes it to the symbolic link referred /*! \brief Creates a BSymLink and initializes it to the symbolic link referred
to by the supplied path name. to by the supplied path name.
\param path the symbolic link's path name \param path the symbolic link's path name
*/ */
BSymLink::BSymLink(const char *path) BSymLink::BSymLink(const char *path)
: BNode(path) :
BNode(path)
{ {
} }
// constructor
/*! \brief Creates a BSymLink and initializes it to the symbolic link referred /*! \brief Creates a BSymLink and initializes it to the symbolic link referred
to by the supplied path name relative to the specified BDirectory. to by the supplied path name relative to the specified BDirectory.
\param dir the BDirectory, relative to which the symbolic link's path name \param dir the BDirectory, relative to which the symbolic link's path name
@@ -79,11 +83,12 @@ BSymLink::BSymLink(const char *path)
\param path the symbolic link's path name relative to \a dir \param path the symbolic link's path name relative to \a dir
*/ */
BSymLink::BSymLink(const BDirectory *dir, const char *path) BSymLink::BSymLink(const BDirectory *dir, const char *path)
: BNode(dir, path) :
BNode(dir, path)
{ {
} }
// destructor
//! Frees all allocated resources. //! Frees all allocated resources.
/*! If the BSymLink is properly initialized, the symbolic link's file /*! If the BSymLink is properly initialized, the symbolic link's file
descriptor is closed. descriptor is closed.
@@ -92,7 +97,7 @@ BSymLink::~BSymLink()
{ {
} }
// ReadLink
//! Reads the contents of the symbolic link into a buffer. //! Reads the contents of the symbolic link into a buffer.
/*! The string written to the buffer will be null-terminated. /*! The string written to the buffer will be null-terminated.
\param buf the buffer \param buf the buffer
@@ -125,7 +130,7 @@ BSymLink::ReadLink(char *buffer, size_t size)
return linkLen; return linkLen;
} }
// MakeLinkedPath
/*! \brief Combines a directory path and the contents of this symbolic link to /*! \brief Combines a directory path and the contents of this symbolic link to
an absolute path. an absolute path.
\param dirPath the path name of the directory \param dirPath the path name of the directory
@@ -141,9 +146,9 @@ BSymLink::ReadLink(char *buffer, size_t size)
ssize_t ssize_t
BSymLink::MakeLinkedPath(const char *dirPath, BPath *path) BSymLink::MakeLinkedPath(const char *dirPath, BPath *path)
{ {
// R5 seems to convert the dirPath to a BDirectory, which causes links to // BeOS seems to convert the dirPath to a BDirectory, which causes links to
// be resolved, i.e. a "/tmp" dirPath expands to "/boot/var/tmp". // be resolved.
// That does also mean, that the dirPath must exists! // This does also mean that the dirPath must exist!
if (!dirPath || !path) if (!dirPath || !path)
return B_BAD_VALUE; return B_BAD_VALUE;
BDirectory dir(dirPath); BDirectory dir(dirPath);
@@ -153,7 +158,7 @@ BSymLink::MakeLinkedPath(const char *dirPath, BPath *path)
return result; return result;
} }
// MakeLinkedPath
/*! \brief Combines a directory path and the contents of this symbolic link to /*! \brief Combines a directory path and the contents of this symbolic link to
an absolute path. an absolute path.
\param dir the BDirectory referring to the directory \param dir the BDirectory referring to the directory
@@ -184,7 +189,7 @@ BSymLink::MakeLinkedPath(const BDirectory *dir, BPath *path)
return result; return result;
} }
// IsAbsolute
//! Returns whether this BSymLink refers to an absolute link. //! Returns whether this BSymLink refers to an absolute link.
/*! /return /*! /return
- \c true, if the object is properly initialized and the symbolic link it - \c true, if the object is properly initialized and the symbolic link it
@@ -209,6 +214,7 @@ void BSymLink::_MissingSymLink4() {}
void BSymLink::_MissingSymLink5() {} void BSymLink::_MissingSymLink5() {}
void BSymLink::_MissingSymLink6() {} void BSymLink::_MissingSymLink6() {}
//! Returns the BSymLink's file descriptor. //! Returns the BSymLink's file descriptor.
/*! To be used instead of accessing the BNode's private \c fFd member directly. /*! To be used instead of accessing the BNode's private \c fFd member directly.
\return the file descriptor, or -1, if not properly initialized. \return the file descriptor, or -1, if not properly initialized.
@@ -218,9 +224,3 @@ BSymLink::get_fd() const
{ {
return fFd; return fFd;
} }
#ifdef USE_OPENBEOS_NAMESPACE
}; // namespace OpenBeOS
#endif