cisst-saw
Loading...
Searching...
No Matches
cmnStrings.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4/*
5 Author(s): Anton Deguet
6 Created on: 2009-11-08
7
8 (C) Copyright 2009-2020 Johns Hopkins University (JHU), All Rights Reserved.
9
10--- begin cisst license - do not edit ---
11
12This software is provided "as is" under an open source license, with
13no warranty. The complete license can be found in license.txt and
14http://www.cisst.org/cisst/license.txt.
15
16--- end cisst license ---
17
18*/
19
20
25#pragma once
26
27#ifndef _cmnStrings_h
28#define _cmnStrings_h
29
32
33#include <string>
34#include <vector>
35#include <stdarg.h>
36#include <stdio.h>
37
41inline int cmn_snprintf(char * destination, size_t size, const char * format, ...) {
42 va_list arguments;
43 va_start(arguments, format);
44 int result;
45#if (CISST_COMPILER == CISST_DOTNET2003)
46 result = _vsnprintf(destination, size, format, arguments);
47#elif (CISST_COMPILER == CISST_DOTNET2005) || (CISST_COMPILER == CISST_DOTNET2008)
48 result = vsnprintf_s(destination, size, _TRUNCATE, format, arguments);
49#else
50 result = vsnprintf(destination, size, format, arguments);
51#endif
52 va_end(arguments);
53 return result;
54}
55
57CISST_EXPORT void cmnStringReplaceAll(std::string & userString,
58 const std::string & oldString, const std::string & newString);
59
62CISST_EXPORT std::string cmnStringToUnderscoreLower(const std::string & input);
63
64#endif // _cmnStrings_h
Macros to export the symbols of cisstCommon (in a Dll).
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Portability across compilers and operating systems tools.
CISST_EXPORT void cmnStringReplaceAll(std::string &userString, const std::string &oldString, const std::string &newString)
CISST_EXPORT std::string cmnStringToUnderscoreLower(const std::string &input)
int cmn_snprintf(char *destination, size_t size, const char *format,...)
Definition cmnStrings.h:41
size_type size(void) const
Definition vctDynamicConstMatrixBase.h:228