OSVR-Core
LogUtils.h
Go to the documentation of this file.
1 
11 // Copyright 2016 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_LogUtils_h_GUID_02DD3C28_81BA_41B4_8F4B_37C35A97F361
26 #define INCLUDED_LogUtils_h_GUID_02DD3C28_81BA_41B4_8F4B_37C35A97F361
27 
28 // Internal Includes
29 // - none
30 
31 // Library/third-party includes
32 #include <boost/algorithm/string/classification.hpp>
33 #include <boost/algorithm/string/trim_all.hpp>
34 
35 // Standard includes
36 #include <string>
37 
38 namespace osvr {
39 namespace util {
40  namespace log {
41  inline std::string sanitizeFilenamePiece(std::string input) {
42  namespace alg = boost::algorithm;
43  auto acceptable_chars_pred =
44  alg::is_alnum() || alg::is_digit() || alg::is_any_of("-_");
45  auto virtual_spaces = !acceptable_chars_pred;
49  alg::trim_fill_if(input, "_", virtual_spaces);
50  return input;
51  }
52  } // end namespace log
53 } // end namespace util
54 } // end namespace osvr
55 
56 #endif // INCLUDED_LogUtils_h_GUID_02DD3C28_81BA_41B4_8F4B_37C35A97F361
Definition: RunLoopManager.h:42
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
std::string sanitizeFilenamePiece(std::string input)
Definition: LogUtils.h:41