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
|
/*
* ====================================================================
* Copyright (c) 2002-2004 The RapidSvn Group. All rights reserved.
*
* This software is licensed as described in the file LICENSE.txt,
* which you should have received as part of this distribution.
*
* This software consists of voluntary contributions made by many
* individuals. For exact contribution history, see the revision
* history and logs, available at http://rapidsvn.tigris.org/.
* ====================================================================
*/
#ifndef _SVNCPP_PATH_HPP_
#define _SVNCPP_PATH_HPP_
// stl
#include <string>
namespace svn
{
/**
* Encapsulation for Subversion Path handling
*/
class Path
{
private:
std::string m_path;
/**
* initialize the class
*
* @param path Path string
*/
void init (const char * path);
public:
/**
* Constructor that takes a string as parameter.
* The string is converted to subversion internal
* representation. The string is copied.
*
* @param path Path string
*/
Path (const std::string & path = "");
/**
* Constructor
*
* @see Path::Path (const std::string &)
* @param path Path string
*/
Path (const char * path);
/**
* Copy constructor
*
* @param path Path to be copied
*/
Path (const Path & path);
/**
* Assignment operator
*/
Path& operator=(const Path&);
/**
* @return Path string
*/
const std::string &
path () const;
/**
* @return Path string as c string
*/
const char *
c_str() const;
/**
* check whether a path is set. Right now
* this checks only if the string is non-
* empty.
*
* @return true if there is a path set
*/
bool
isset() const;
/**
* adds a new URL component to the path
*
* @param component new component to add
*/
void
addComponent (const char * component);
/**
* adds a new URL component to the path
*
* @param component new component to add
*/
void
addComponent (const std::string & component);
/**
* split path in its components
*
* @param dirpath directory/path component
* @param basename filename
*/
void
split (std::string & dirpath, std::string & basename) const;
/**
* split path in its components including
* file extension
*
* @param dir directory component
* @param filename filename
* @param ext extension (including leading dot ".")
*/
void
split (std::string & dir, std::string & filename, std::string & ext) const;
/**
* returns the temporary directory
*/
static Path
getTempDir ();
/** return the length of the path-string */
size_t
length () const;
/** returns the path with native separators */
std::string
native () const;
};
}
#endif
/* -----------------------------------------------------------------
* local variables:
* eval: (load-file "../../rapidsvn-dev.el")
* end:
*/
|