1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef STRING_H_ 18 19 #define STRING_H_ 20 21 #include <utils/String8.h> 22 23 namespace android { 24 25 class string { 26 public: 27 typedef size_t size_type; 28 static size_type npos; 29 30 string(); 31 string(const char *s); 32 string(const char *s, size_t length); 33 string(const string &from, size_type start, size_type length = npos); 34 35 const char *c_str() const; 36 size_type size() const; 37 38 void clear(); 39 void erase(size_type from, size_type length); 40 41 size_type find(char c) const; 42 43 bool operator<(const string &other) const; 44 bool operator==(const string &other) const; 45 46 string &operator+=(char c); 47 48 private: 49 String8 mString; 50 }; 51 52 } // namespace android 53 54 #endif // STRING_H_ 55