Edit

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

Branch :

  • Show log

    Commit

  • Author : Jamie Madill
    Date : 2015-05-21 08:17:18
    Hash : 8c5aeb6c
    Message : Add some string helper classes. *re-land with build fix for Clang* These helper functions mirror some utilities in Chrome, for splitting strings along whitespace, or reading file contents into a string. Also remove the hack for skipping the doubly-defined GLX header. BUG=angleproject:892,angleproject:998 Change-Id: Ife43fbf5035a3be7820460bea1b26d0e632a4fb0 Reviewed-on: https://chromium-review.googlesource.com/272518 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-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
    {
    
    void SplitString(const std::string &input,
                     char delimiter,
                     std::vector<std::string> *tokensOut);
    
    void SplitStringAlongWhitespace(const std::string &input,
                                    std::vector<std::string> *tokensOut);
    
    bool HexStringToUInt(const std::string &input, unsigned int *uintOut);
    
    bool ReadFileToString(const std::string &path, std::string *stringOut);
    
    }
    
    #endif // LIBANGLE_STRING_UTILS_H_