https://github.com/hughperkins/cpp-batteries
'batteries included' for C++. Lightweight, commonly-used methods, not specific to any one project
https://github.com/hughperkins/cpp-batteries
Last synced: 7 months ago
JSON representation
'batteries included' for C++. Lightweight, commonly-used methods, not specific to any one project
- Host: GitHub
- URL: https://github.com/hughperkins/cpp-batteries
- Owner: hughperkins
- License: mpl-2.0
- Created: 2015-01-03T01:48:51.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-03T02:32:19.000Z (almost 11 years ago)
- Last Synced: 2025-02-06T02:47:25.958Z (9 months ago)
- Language: C++
- Size: 383 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
cpp-batteries
============='batteries included' for C++. Lightweight, commonly-used methods, not specific to any one project
Compared to 'boost':
* lightweight
* easy to compileTo be accepted for inclusion in this library, methods should be:
* not project specific
* fast to #include
* easy to build
* ideally, should work on at least linux-64, and windows-64cpp-batteries/gtest_supp
------------------------Googletest is one of the best unit-testing frameworks for C++. This include provides an additional googletest assert for floats:
```
EXPECT_FLOAT_NEAR(var1, var2);
```This will compare the absolute difference of (var1-var2) with var1, and only if the difference is 10,000 times smaller than var1, will the expect pass. The error message truncates var1 and var2 to several decimal places, rather than displaying it as around 15 or so.
cpp-batteries/Timer.h
---------------------Use to measure elapsed time during your applications, for testing performance. Use like this:
```
Timer timer;
// do some work here
// ...
timer.timeCheck("did some work");
// do some work here
// ...
timer.timeCheck("did some more work");
```cpp-batteries/stringhelper.h
----------------------------Provides standard string functionalities:
```
vector split( string targetString, string splitCharacter ); // split someString by splitCharacter
string toString( T target ); // converts `target` to a string, using `operator<<`
std::string trim( const std::string &target );
double atof( std::string stringvalue ); // since atof and atoi dont work on string by default, only on char *
double atoi( std::string stringvalue );
string toLower(std::string in );
```cpp-batteries/filehelper.h
--------------------------```
long FileHelper::getFileLength(std::string filepath );
void FileHelper::createDirectory( const std::string dirpath );
bool FileHelper::fileExists( const std::string filepath );
void FileHelper::deleteFile( const std::string filepath );
```