summaryrefslogtreecommitdiffabout
path: root/include/sitecing/sitecing_util.h
Side-by-side diff
Diffstat (limited to 'include/sitecing/sitecing_util.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/sitecing/sitecing_util.h87
1 files changed, 3 insertions, 84 deletions
diff --git a/include/sitecing/sitecing_util.h b/include/sitecing/sitecing_util.h
index d1a6c4a..f642c74 100644
--- a/include/sitecing/sitecing_util.h
+++ b/include/sitecing/sitecing_util.h
@@ -4,6 +4,7 @@
#include <sys/types.h>
#include <string>
#include <konforka/exception.h>
+#include <konforka/util.h>
/**
* @file
@@ -21,14 +22,7 @@ namespace sitecing {
utility_error(const string& fi,const string& fu,int l,const string& w)
: konforka::exception(fi,fu,l,w) { }
};
- /**
- * Restricted sequence encountered.
- */
- class utility_restricted_sequence : public utility_error {
- public:
- utility_restricted_sequence(const string& fi,const string& fu,int l,const string& w)
- : utility_error(fi,fu,l,w) { }
- };
+
/**
* No prefix or suffix found to strip out.
*/
@@ -55,16 +49,6 @@ namespace sitecing {
};
/**
- * Went up beyond root.
- * @todo TODO: wish I could remember the details -- document me.
- */
- class utility_beyond_root : public utility_error {
- public:
- utility_beyond_root(const string& fi,const string& fu,int l,const string& w)
- : utility_error(fi,fu,l,w) { }
- };
-
- /**
* The file lock object. Released at the object destruction.
*/
class file_lock {
@@ -215,48 +199,6 @@ namespace sitecing {
};
/**
- * normalize_path options enumeration.
- * @see normalize_path()
- */
- enum normalize_path_options {
- /**
- * Restrict the /../ sequence.
- */
- restrict_dotdot = 1,
- /**
- * Strip out the leading slash.
- */
- strip_leading_slash = 2,
- /**
- * Strip out the trailing slash.
- */
- strip_trailing_slash = 4
- };
- /**
- * combine_path options enumeration.
- * @see combine_path()
- */
- enum combine_path_options {
- /**
- * The origin is file. Otherwise it is directory.
- */
- origin_is_file = 1,
- /**
- * Fail if we've gone up beyond root.
- */
- fail_beyond_root = 2
- };
-
- /**
- * Normalize pathname by stripping duplicate slashes, etc.
- * @param path the path name.
- * @param opts options.
- * @return the normalized path.
- * @see normalize_path_options
- * @todo TODO: document exceptions.
- */
- string normalize_path(const string& path,int opts=(restrict_dotdot|strip_trailing_slash));
- /**
* Strip prefix from the string.
* @param str the string.
* @param prefix prefix to strip.
@@ -272,30 +214,7 @@ namespace sitecing {
* @todo TODO: document exceptions.
*/
string strip_suffix(const string& str,const string& suffix);
- /**
- * Get the directory part of the filename.
- * @param filename the full file name.
- * @return the directory part.
- */
- string dir_name(const string& filename);
- /**
- * Combine path with the relative path.
- * @param origin the origin.
- * @param relative relative path to combine origin with.
- * @param opts options.
- * @return the pathc combined.
- * @see combine_path_options
- * @todo TODO: document exceptions.
- */
- string combine_path(const string& origin,const string& relative,int opts=origin_is_file);
-
- /**
- * Create directory and parent directories if needed.
- * @param path the pathname.
- * @param mode the mode for newly created directories.
- */
- void make_path(const string& path,mode_t mode);
-
+
/**
* Change to the directory and pop back at object's destruction (e.g. when
* the object goes out of scope).