Commit fc8807a7 authored by Davis King's avatar Davis King

Added constructors that take const char* so that you don't have to explicitly

convert literal strings to files or directories.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403431
parent df82747e
...@@ -24,8 +24,8 @@ namespace dlib ...@@ -24,8 +24,8 @@ namespace dlib
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
file:: void file::
file ( init (
const std::string& name const std::string& name
) )
{ {
...@@ -95,8 +95,8 @@ namespace dlib ...@@ -95,8 +95,8 @@ namespace dlib
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
directory:: void directory::
directory ( init (
const std::string& name const std::string& name
) )
{ {
......
...@@ -59,6 +59,7 @@ namespace dlib ...@@ -59,6 +59,7 @@ namespace dlib
}; };
void init ( const std::string& name);
public: public:
...@@ -94,7 +95,11 @@ namespace dlib ...@@ -94,7 +95,11 @@ namespace dlib
file ( file (
const std::string& name const std::string& name
); ) { init(name); }
file (
const char* name
) { init(name); }
inline file ( inline file (
const file& item const file& item
...@@ -181,6 +186,9 @@ namespace dlib ...@@ -181,6 +186,9 @@ namespace dlib
is_root() == state->name.size() == 0 is_root() == state->name.size() == 0
!*/ !*/
void init (const std::string& name);
public: public:
struct data struct data
...@@ -229,7 +237,11 @@ namespace dlib ...@@ -229,7 +237,11 @@ namespace dlib
directory ( directory (
const std::string& name const std::string& name
); ) { init(name); }
directory (
const char* name
) { init(name); }
inline directory ( inline directory (
const directory& item const directory& item
......
...@@ -23,8 +23,8 @@ namespace dlib ...@@ -23,8 +23,8 @@ namespace dlib
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
file:: void file::
file ( init (
const std::string& name const std::string& name
) )
{ {
...@@ -100,8 +100,8 @@ namespace dlib ...@@ -100,8 +100,8 @@ namespace dlib
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
directory:: void directory::
directory ( init (
const std::string& name const std::string& name
) )
{ {
......
...@@ -66,6 +66,7 @@ namespace dlib ...@@ -66,6 +66,7 @@ namespace dlib
unsigned long count; unsigned long count;
}; };
void init(const std::string& name);
public: public:
...@@ -99,7 +100,11 @@ namespace dlib ...@@ -99,7 +100,11 @@ namespace dlib
file ( file (
const std::string& name const std::string& name
); ) { init(name); }
file (
const char* name
) { init(name); }
inline file ( inline file (
const file& item const file& item
...@@ -187,6 +192,8 @@ namespace dlib ...@@ -187,6 +192,8 @@ namespace dlib
!*/ !*/
void init(const std::string& name);
public: public:
struct private_constructor{}; struct private_constructor{};
inline directory ( inline directory (
...@@ -224,7 +231,11 @@ namespace dlib ...@@ -224,7 +231,11 @@ namespace dlib
directory ( directory (
const std::string& name const std::string& name
); ) { init(name); }
directory (
const char* name
) { init(name); }
inline directory ( inline directory (
const directory& item const directory& item
......
...@@ -96,6 +96,14 @@ namespace dlib ...@@ -96,6 +96,14 @@ namespace dlib
accessed. accessed.
!*/ !*/
file (
const char* name
);
/*!
ensures
- this function is idential to file(const std::string& name)
!*/
file ( file (
const file& item const file& item
); );
...@@ -230,6 +238,14 @@ namespace dlib ...@@ -230,6 +238,14 @@ namespace dlib
accessed. accessed.
!*/ !*/
directory (
const char* name
);
/*!
ensures
- this function is idential to directory(const std::string& name)
!*/
directory ( directory (
const directory& item const directory& item
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment