xref: /aosp_15_r20/external/libchrome-gestures/include/string_util.h (revision aed3e5085e770be5b69ce25295ecf6ddf906af95)
1*aed3e508SAndroid Build Coastguard Worker // Copyright 2014 The ChromiumOS Authors
2*aed3e508SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*aed3e508SAndroid Build Coastguard Worker // found in the LICENSE file.
4*aed3e508SAndroid Build Coastguard Worker 
5*aed3e508SAndroid Build Coastguard Worker #ifndef GESTURES_STRING_UTIL_H_
6*aed3e508SAndroid Build Coastguard Worker #define GESTURES_STRING_UTIL_H_
7*aed3e508SAndroid Build Coastguard Worker 
8*aed3e508SAndroid Build Coastguard Worker #include <string>
9*aed3e508SAndroid Build Coastguard Worker #include <vector>
10*aed3e508SAndroid Build Coastguard Worker 
11*aed3e508SAndroid Build Coastguard Worker #include "include/compiler_specific.h"
12*aed3e508SAndroid Build Coastguard Worker 
13*aed3e508SAndroid Build Coastguard Worker namespace gestures {
14*aed3e508SAndroid Build Coastguard Worker 
15*aed3e508SAndroid Build Coastguard Worker // Return a C++ string given printf-like input.
16*aed3e508SAndroid Build Coastguard Worker std::string StringPrintf(const char* format, ...)
17*aed3e508SAndroid Build Coastguard Worker       PRINTF_FORMAT(1, 2);
18*aed3e508SAndroid Build Coastguard Worker 
19*aed3e508SAndroid Build Coastguard Worker // Lower-level routine that takes a va_list and appends to a specified
20*aed3e508SAndroid Build Coastguard Worker // string.  All other routines are just convenience wrappers around it.
21*aed3e508SAndroid Build Coastguard Worker void StringAppendV(std::string* dst, const char* format, va_list ap)
22*aed3e508SAndroid Build Coastguard Worker     PRINTF_FORMAT(2, 0);
23*aed3e508SAndroid Build Coastguard Worker 
24*aed3e508SAndroid Build Coastguard Worker // Trims whitespace from the start and end of the input string.  This function
25*aed3e508SAndroid Build Coastguard Worker // is for ASCII strings and only looks for ASCII whitespace.
26*aed3e508SAndroid Build Coastguard Worker std::string TrimWhitespaceASCII(const std::string& input);
27*aed3e508SAndroid Build Coastguard Worker 
28*aed3e508SAndroid Build Coastguard Worker }  // namespace gestures
29*aed3e508SAndroid Build Coastguard Worker 
30*aed3e508SAndroid Build Coastguard Worker #endif  // GESTURES_STRING_UTIL_H_
31