Skip to content

Commit

Permalink
fix to string trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
djmott committed Jul 1, 2016
1 parent 3cd2837 commit 4d30b41
Show file tree
Hide file tree
Showing 9 changed files with 490 additions and 483 deletions.
80 changes: 40 additions & 40 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# Created by .ignore support plugin (hsz.mobi)
### C++ template
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

docs/html
.idea
Doxyfile
.build
!.travis.yml
.*


# Created by .ignore support plugin (hsz.mobi)
### C++ template
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

docs/html
.idea
Doxyfile
.build
!.travis.yml
.*


122 changes: 61 additions & 61 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
sudo: required
dist: trusty
language: cpp
matrix:
include:
- compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
env: COMPILER=g++-5
before_install:
- mkdir -p $TRAVIS_BUILD_DIR/docs/reports/cppcheck $TRAVIS_BUILD_DIR/docs/reports/gcov $TRAVIS_BUILD_DIR/docs/reports/gtest
- mkdir -p $TRAVIS_BUILD_DIR/docs/reports/make $TRAVIS_BUILD_DIR/docs/reports/oclint $TRAVIS_BUILD_DIR/docs/reports/rats
- mkdir -p $TRAVIS_BUILD_DIR/docs/reports/valgrind $TRAVIS_BUILD_DIR/docs/reports/vera++ $TRAVIS_BUILD_DIR/docs/reports/lcov
- mkdir -p $TRAVIS_BUILD_DIR/docs/html $TRAVIS_BUILD_DIR/3rdparty $TRAVIS_BUILD_DIR/build
- pip install --user cpp-coveralls
- sudo apt-get update -qq
- sudo apt-get install -y -qq lcov gcovr curl libgtest-dev unzip valgrind rats cppcheck vera++
- cd /usr/src/gtest
- sudo cmake .
- sudo cmake --build .
- sudo mv libg* /usr/local/lib/
- cd $TRAVIS_BUILD_DIR/3rdparty
- wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-2.6.1.zip
- wget https://sonarqube.com/static/cpp/build-wrapper-linux-x86.zip
- unzip sonar-scanner-2.6.1.zip
- unzip build-wrapper-linux-x86.zip
- export PATH=$PWD/sonar-scanner-2.6.1/bin:$PWD/build-wrapper-linux-x86:$PATH
script:
- cd $TRAVIS_BUILD_DIR/build
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE -DXTD_CI_BUILD=TRUE .. 2>&1 | tee ../docs/reports/make/cmake.log
- build-wrapper-linux-x86-64 --out-dir . make clean all coverage_tests examples
- $TRAVIS_BUILD_DIR/build/tests/coverage_tests --xml:$TRAVIS_BUILD_DIR/docs/reports/gtest
- cd $TRAVIS_BUILD_DIR/
- valgrind --tool=memcheck -v --trace-children=yes --xml=yes --xml-file=docs/reports/valgrind/coverage_tests.memcheck.xml $TRAVIS_BUILD_DIR/build/tests/coverage_tests
- for item in $(find src -type f); do vera++ -x docs/reports/vera++/$(basename $item).xml $item > /dev/null; done
- for item in $(find include -type f); do vera++ -x docs/reports/vera++/$(basename $item).xml $item > /dev/null; done
- for item in $(find include -name *.hpp); do cppcheck --inline-suppr --suppressions-list=cppcheck-suppressions.txt --std=c++11 --platform=unix64 --enable=all --xml-version=2 $item 2> docs/reports/cppcheck/$(basename $item).xml; done
- for item in $(find src -name *.cpp); do cppcheck --inline-suppr --suppressions-list=cppcheck-suppressions.txt --std=c++11 --platform=unix64 --enable=all --xml-version=2 $item 2> docs/reports/cppcheck/$(basename $item).xml; done
- rats --xml -w 3 src include > docs/reports/rats/rats.xml
- cd $TRAVIS_BUILD_DIR/build/tests
- if [ -e "$(ls *.xml)" ]; then cp *.xml $TRAVIS_BUILD_DIR/docs/reports/gtest; fi
- for item in $( find -name '*.gcda' ); do gcov -l $item; done
- for item in $( find -name '*.gcda' ); do gcovr -x -r . > $TRAVIS_BUILD_DIR/docs/reports/gcov/$(basename $item).xml; done
- cd $TRAVIS_BUILD_DIR/
- sonar-scanner -Dsonar.host.url=https://nemo.sonarqube.org -Dsonar.login=$SONAR_TOKEN
success:
- cd $TRAVIS_BUILD_DIR/docs/html
- git init
- git remote add docs git@github.com:djmott/xtd-docs.git
- git pull
- cd $TRAVIS_BUILD_DIR/build
- make docs
- cd $TRAVIS_BUILD_DIR/docs/html
- git commit -am "travis-ci documentation update"
- git push docs master
after_success:
- coveralls
sudo: required
dist: trusty
language: cpp
matrix:
include:
- compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
env: COMPILER=g++-5
before_install:
- mkdir -p $TRAVIS_BUILD_DIR/docs/reports/cppcheck $TRAVIS_BUILD_DIR/docs/reports/gcov $TRAVIS_BUILD_DIR/docs/reports/gtest
- mkdir -p $TRAVIS_BUILD_DIR/docs/reports/make $TRAVIS_BUILD_DIR/docs/reports/oclint $TRAVIS_BUILD_DIR/docs/reports/rats
- mkdir -p $TRAVIS_BUILD_DIR/docs/reports/valgrind $TRAVIS_BUILD_DIR/docs/reports/vera++ $TRAVIS_BUILD_DIR/docs/reports/lcov
- mkdir -p $TRAVIS_BUILD_DIR/docs/html $TRAVIS_BUILD_DIR/3rdparty $TRAVIS_BUILD_DIR/build
- pip install --user cpp-coveralls
- sudo apt-get update -qq
- sudo apt-get install -y -qq lcov gcovr curl libgtest-dev unzip valgrind rats cppcheck vera++
- cd /usr/src/gtest
- sudo cmake .
- sudo cmake --build .
- sudo mv libg* /usr/local/lib/
- cd $TRAVIS_BUILD_DIR/3rdparty
- wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-2.6.1.zip
- wget https://sonarqube.com/static/cpp/build-wrapper-linux-x86.zip
- unzip sonar-scanner-2.6.1.zip
- unzip build-wrapper-linux-x86.zip
- export PATH=$PWD/sonar-scanner-2.6.1/bin:$PWD/build-wrapper-linux-x86:$PATH
script:
- cd $TRAVIS_BUILD_DIR/build
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE -DXTD_CI_BUILD=TRUE .. 2>&1 | tee ../docs/reports/make/cmake.log
- build-wrapper-linux-x86-64 --out-dir . make clean all coverage_tests examples
- $TRAVIS_BUILD_DIR/build/tests/coverage_tests --xml:$TRAVIS_BUILD_DIR/docs/reports/gtest
- cd $TRAVIS_BUILD_DIR/
- valgrind --tool=memcheck -v --trace-children=yes --xml=yes --xml-file=docs/reports/valgrind/coverage_tests.memcheck.xml $TRAVIS_BUILD_DIR/build/tests/coverage_tests
- for item in $(find src -type f); do vera++ -x docs/reports/vera++/$(basename $item).xml $item > /dev/null; done
- for item in $(find include -type f); do vera++ -x docs/reports/vera++/$(basename $item).xml $item > /dev/null; done
- for item in $(find include -name *.hpp); do cppcheck --inline-suppr --suppressions-list=cppcheck-suppressions.txt --std=c++11 --platform=unix64 --enable=all --xml-version=2 $item 2> docs/reports/cppcheck/$(basename $item).xml; done
- for item in $(find src -name *.cpp); do cppcheck --inline-suppr --suppressions-list=cppcheck-suppressions.txt --std=c++11 --platform=unix64 --enable=all --xml-version=2 $item 2> docs/reports/cppcheck/$(basename $item).xml; done
- rats --xml -w 3 src include > docs/reports/rats/rats.xml
- cd $TRAVIS_BUILD_DIR/build/tests
- if [ -e "$(ls *.xml)" ]; then cp *.xml $TRAVIS_BUILD_DIR/docs/reports/gtest; fi
- for item in $( find -name '*.gcda' ); do gcov -l $item; done
- for item in $( find -name '*.gcda' ); do gcovr -x -r . > $TRAVIS_BUILD_DIR/docs/reports/gcov/$(basename $item).xml; done
- cd $TRAVIS_BUILD_DIR/
- sonar-scanner -Dsonar.host.url=https://nemo.sonarqube.org -Dsonar.login=$SONAR_TOKEN
success:
- cd $TRAVIS_BUILD_DIR/docs/html
- git init
- git remote add docs git@github.com:djmott/xtd-docs.git
- git pull
- cd $TRAVIS_BUILD_DIR/build
- make docs
- cd $TRAVIS_BUILD_DIR/docs/html
- git commit -am "travis-ci documentation update"
- git push docs master
after_success:
- coveralls
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
eXtended Template Library
=========================
|||
|---:|:---|
|[Travis](https://travis-ci.org/djmott/xtl)|![Travis Build Status](https://travis-ci.org/djmott/xtl.svg?branch=master)|
|[Coveralls](https://coveralls.io/github/djmott/xtl)|[![Coverage Status](https://coveralls.io/repos/github/djmott/xtl/badge.svg?branch=master)](https://coveralls.io/github/djmott/xtl?branch=master)|
|[SonarQube](https://sonarqube.com/overview?id=xtl)|![Quality Gate](http://nemo.sonarqube.org/api/badges/gate?key=xtl&blinking=true)|
|[Open Hub](https://www.openhub.net/p/libxtl)|![Open Hub project report](https://www.openhub.net/p/libxtl/widgets/project_thin_badge.gif)|

XTL is a series of C++ template metaprogramming patterns, idioms, algorithms and libraries that solve a variety of programming tasks. XTL supplements and cooperates with the STL by providing some frequently used components that are otherwise absent from the standard. The library can be used out-of-the-box in many cases by simply including the desired header since most components are header-only. A few components require linking to a run-time component so they will need to be compiled. Also included are a number of tutorials on C++ template metaprogramming (TMP) that explains the various techniques used.

This is a public release of a much larger private repo which I've maintained over the years and the time has come to begin releasing it incrementally to the public as time permits. Different quality standards exist for public and private code so will require additional CI integration, unit, integration and system tests, documentation, etc. Everything in XTL has proven utility in several production and commercial applications. It is my sincere desire to offer a valuable contribution to the open source communities which have handsomely blessed my bank account over the years with their public submissions.

XTL is copyright by David Mott and licensed under the Boost Version 1.0 license agreement. See [LICENSE.md](LICENSE.md) or [http://www.boost.org/LICENSE_1_0.txt](http://www.boost.org/LICENSE_1_0.txt) for license details.

eXtended Template Library
=========================
|||
|---:|:---|
|[Travis](https://travis-ci.org/djmott/xtl)|![Travis Build Status](https://travis-ci.org/djmott/xtl.svg?branch=master)|
|[Coveralls](https://coveralls.io/github/djmott/xtl)|[![Coverage Status](https://coveralls.io/repos/github/djmott/xtl/badge.svg?branch=master)](https://coveralls.io/github/djmott/xtl?branch=master)|
|[SonarQube](https://sonarqube.com/overview?id=xtl)|![Quality Gate](http://nemo.sonarqube.org/api/badges/gate?key=xtl&blinking=true)|
|[Open Hub](https://www.openhub.net/p/libxtl)|![Open Hub project report](https://www.openhub.net/p/libxtl/widgets/project_thin_badge.gif)|

XTL is a series of C++ template metaprogramming patterns, idioms, algorithms and libraries that solve a variety of programming tasks. XTL supplements and cooperates with the STL by providing some frequently used components that are otherwise absent from the standard. The library can be used out-of-the-box in many cases by simply including the desired header since most components are header-only. A few components require linking to a run-time component so they will need to be compiled. Also included are a number of tutorials on C++ template metaprogramming (TMP) that explains the various techniques used.

This is a public release of a much larger private repo which I've maintained over the years and the time has come to begin releasing it incrementally to the public as time permits. Different quality standards exist for public and private code so will require additional CI integration, unit, integration and system tests, documentation, etc. Everything in XTL has proven utility in several production and commercial applications. It is my sincere desire to offer a valuable contribution to the open source communities which have handsomely blessed my bank account over the years with their public submissions.

XTL is copyright by David Mott and licensed under the Boost Version 1.0 license agreement. See [LICENSE.md](LICENSE.md) or [http://www.boost.org/LICENSE_1_0.txt](http://www.boost.org/LICENSE_1_0.txt) for license details.

2 changes: 1 addition & 1 deletion include/xtd/socket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ General purpose socket
@{
*/


#pragma once

#if ((XTD_OS_WINDOWS | XTD_OS_MINGW) & XTD_OS)
static_assert(_WIN32_WINNT >= 0x600, "unsupported target Windows version");
#define poll WSAPoll
#pragma comment(lib, "ws2_32.lib")
#endif

#if (XTD_OS_MINGW & XTD_OS)
Expand Down
9 changes: 8 additions & 1 deletion include/xtd/string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ namespace xtd{
///Trim leading whitespace
xstring& ltrim(){
auto oBegin = _super_t::begin();
if (oBegin >= _super_t::end()){
return *this;
}
for(;oBegin != _super_t::end() ; ++oBegin){
if (!std::iswspace(*oBegin)){
break;
Expand All @@ -84,7 +87,11 @@ namespace xtd{

///Trim trailing whitespace
xstring& rtrim(){
auto oBegin = _super_t::end()--;
auto oBegin = _super_t::end();
if (oBegin <= _super_t::begin()){
return *this;
}
--oBegin;
for(;oBegin != _super_t::begin() ; --oBegin){
if (!std::iswspace(*oBegin) && *oBegin){
break;
Expand Down
Loading

0 comments on commit 4d30b41

Please sign in to comment.