Skip to content
Snippets Groups Projects
Commit a680c03e authored by hcasse's avatar hcasse
Browse files

cstring: added missing endsWith().

sys: StopWatch uses Time now.
util: improved UniquePtr, added Time class.
parent 19c0071f
Branches
No related tags found
No related merge requests found
......@@ -49,6 +49,7 @@ public:
inline bool startsWith(const char *str) const;
inline bool startsWith(const CString str) const;
inline bool startsWith(const String& str) const;
inline bool endsWith(const char *str) const;
inline bool endsWith(const CString str) const;
inline bool endsWith(const String& str) const;
......
......@@ -22,6 +22,7 @@
#define ELM_SYS_STOP_WATCH_H
#include <elm/types.h>
#include <elm/util/Time.h>
namespace elm { namespace sys {
......@@ -30,31 +31,16 @@ typedef t::uint64 time_t;
// StopWatch class
class StopWatch {
time_t start_time, stop_time;
#if defined(__WIN32) || defined(__WIN64)
time_t delay_time;
#endif
public:
void start(void);
void stop(void);
inline time_t delay(void) const;
inline time_t startTime(void) const;
inline time_t stopTime(void) const;
inline Time delay(void) const { return stop_time - start_time; }
inline Time startTime(void) const { return start_time; }
inline Time stopTime(void) const { return stop_time; }
private:
Time start_time, stop_time;
};
// Inlines
inline time_t StopWatch::delay(void) const {
return stop_time - start_time;
}
inline time_t StopWatch::startTime(void) const {
return start_time;
}
inline time_t StopWatch::stopTime(void) const {
return stop_time;
}
} } // elm::sys
#endif // ELM_SYS_STOP_WATCH_H
......@@ -23,7 +23,6 @@
namespace elm {
// AutoDestructor class
template <class T>
class UniquePtr {
public:
......@@ -49,6 +48,8 @@ private:
T *p;
};
template <class T> UniquePtr<T> unique(T *p) { return UniquePtr<T>(p); }
};
#endif // ELM_UTIL_UNIQUEPTR_H
......
......@@ -119,6 +119,7 @@ set(LIBELM_LA_SOURCES
"util_Ref.cpp"
"util_strong_type.cpp"
"util_test.cpp"
"util_Time.cpp"
"util_VarArg.cpp"
"util_Version.cpp"
"util_WAHVector.cpp"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment