Edit

kc3-lang/angle/src/common/string_utils.h

Branch :

  • Show log

    Commit

  • Author : Corentin Wallez
    Date : 2015-11-24 11:15:57
    Hash : 47ac69c1
    Message : Update gpu_test_expectations to support OSX 10.11 On the Chromium side there was also a large refactor of SplitString. This patch includes a replication of that refactor in string_utils and adds the Chromium unittests to string_utils_unittests.cpp BUG=angleproject:1234 Change-Id: I4f71064fbf325c204e98a7b36ead118913d90f2c Reviewed-on: https://chromium-review.googlesource.com/314101 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>

  • src/common/string_utils.h
  • //
    // Copyright 2015 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    // string_utils:
    //   String helper functions.
    //
    
    #ifndef LIBANGLE_STRING_UTILS_H_
    #define LIBANGLE_STRING_UTILS_H_
    
    #include <string>
    #include <vector>
    
    namespace angle
    {
    
    extern const char kWhitespaceASCII[];
    
    enum WhitespaceHandling
    {
        KEEP_WHITESPACE,
        TRIM_WHITESPACE,
    };
    
    enum SplitResult
    {
        SPLIT_WANT_ALL,
        SPLIT_WANT_NONEMPTY,
    };
    
    std::vector<std::string> SplitString(const std::string &input,
                                         const std::string &delimiters,
                                         WhitespaceHandling whitespace,
                                         SplitResult resultType);
    
    void SplitStringAlongWhitespace(const std::string &input,
                                    std::vector<std::string> *tokensOut);
    
    std::string TrimString(const std::string &input, const std::string &trimChars);
    
    bool HexStringToUInt(const std::string &input, unsigned int *uintOut);
    
    bool ReadFileToString(const std::string &path, std::string *stringOut);
    
    }
    
    #endif // LIBANGLE_STRING_UTILS_H_