Enhancement - Path integration

- Implemented Path::operator (std::string) const, to provide an
  automatic cast to std::string for any Path, File or Directory.
- Made use of new cast in various code.
- Changed use of spaces in atoi () calls.
- Switched from std::string::data () to std::string::c_str () calls.
This commit is contained in:
Paul Beckingham
2010-01-16 14:42:36 -05:00
parent a6875ced6e
commit e53ba8110b
9 changed files with 35 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// task - a command line task list manager.
//
// Copyright 2006 - 2009, Paul Beckingham.
// Copyright 2006 - 2010, Paul Beckingham.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under
@@ -33,7 +33,7 @@ Context context;
int main (int argc, char** argv)
{
UnitTest t (31);
UnitTest t (32);
// Path ();
Path p0;
@@ -54,6 +54,9 @@ int main (int argc, char** argv)
Path p3_copy (p3);
t.is (p3.data, p3_copy.data, "Path::Path (Path&)");
// operator (std::string) const;
t.is ((std::string) p3, "/tmp", "Path::operator (std::string) const");
// std::string name () const;
Path p4 ("/a/b/c/file.ext");
t.is (p4.name (), "file.ext", "/a/b/c/file.ext name is file.ext");