Update of /cvsroot/pclasses/pclasses2/include/pclasses/System
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29121/include/pclasses/System
Modified Files:
PathFinder.h
Log Message:
- Use StringList implementation
Index: PathFinder.h
===================================================================
RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/PathFinder.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- PathFinder.h 23 Apr 2005 15:19:31 -0000 1.6
+++ PathFinder.h 28 Apr 2005 10:21:43 -0000 1.7
@@ -9,9 +9,8 @@
// implementation as it may be useful for other too. -- cproch
#include <pclasses/Export.h>
-
-#include <string>
-#include <list>
+#include <pclasses/StringList.h>
+#include <pclasses/Unicode/String.h>
#include <map>
namespace P {
@@ -49,13 +48,15 @@
/**
A list type returned by some functions.
*/
- typedef std::list<std::string> string_list;
+ typedef StringList<Unicode::String> string_list;
+
+ PathFinder();
/**
Creates object with the given path/extension list.
*/
- PathFinder(const std::string & path = std::string(),
- const std::string & ext = std::string());
+ PathFinder(const Unicode::String& path,
+ const Unicode::String& ext);
virtual ~PathFinder();
@@ -63,24 +64,24 @@
Returns a pathSeparator()-delimited string of all paths
added via add/path().
*/
- std::string pathString() const;
+ Unicode::String pathString() const;
/**
Sets the path to p, which should be a pathSeparator()-delimited string.
Returns the number of path elements parsed from p.
*/
- virtual size_t path( const std::string & p );
+ virtual size_t path(const Unicode::String& p);
/**
Sets the path to the given list of directories.
Returns the number of elements in the list.
*/
- virtual size_t path( const string_list & p );
+ virtual size_t path(const string_list& p);
/**
Adds p to the path. May be path_separtor()-delimited.
*/
- virtual void addPath( const std::string & p );
+ virtual void addPath(const Unicode::String& p);
/**
Adds a "search extension." Sample:
@@ -92,25 +93,25 @@
and those with non-traditional extensions, like
"foo_EXT".
*/
- virtual void addExtension( const std::string & ext = std::string() );
+ virtual void addExtension(const Unicode::String& ext);
/**
like addExtension(), but overwrites extension list.
Returns the number of entries parsed from the string.
*/
- virtual size_t extensions( const std::string & ext );
+ virtual size_t extensions(const Unicode::String& ext);
/**
Sets the extensions list to the given list.
Returns the number of entries in p.
*/
- virtual size_t extensions( const string_list & p );
+ virtual size_t extensions(const string_list& p);
/**
Returns the pathSeparator()-delimited listed of file
suffixes to use when searching for a path.
*/
- std::string extensionsString() const;
+ Unicode::String extensionsString() const;
/**
Returns this object's extensions list.
@@ -120,25 +121,25 @@
/**
Returns true if path is readable.
*/
- static bool isAccessible( const std::string & path );
+ static bool isAccessible(const Unicode::String& path);
/**
Returns the "base name" of the given string: any part
following the final directory separator character.
*/
- static std::string basename( const std::string & );
+ static Unicode::String basename(const Unicode::String &);
/**
Returns a platform-dependent directory separator. This
is set when the class is compiled.
*/
- static std::string dirSeparator();
+ static Unicode::String dirSeparator();
/**
Returns a platform-dependent path-list separator string.
This is set when the class is compiled.
*/
- static std::string pathSeparator();
+ static Unicode::String pathSeparator();
/**
Returns the full path of the given resource, provided it could be found
@@ -153,7 +154,8 @@
uses a cache. When caching it will always return
the same result for any given resourcename.
*/
- std::string find( const std::string & resourcename, bool check_cache = true ) const;
+ const Unicode::String& find(const Unicode::String& resourcename,
+ bool check_cache = true) const;
/**
Empties the hit-cache used by find().
@@ -169,11 +171,11 @@
const string_list & path() const;
private:
- string_list paths;
- string_list exts;
- typedef std::map < std::string, std::string > StringStringMap;
- typedef StringStringMap::iterator StringStringIterator;
- mutable StringStringMap hitcache;
+ string_list _paths;
+ string_list _exts;
+
+ typedef std::map<Unicode::String, Unicode::String> StringStringMap;
+ mutable StringStringMap _hitcache;
};
} // !namespace System
|