1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef GUESS_H 24 #define GUESS_H 25 26 #define GUESS_SEPARATOR_OPEN '[' 27 #define GUESS_SEPARATOR_CLOSE ']' 28 #define GUESS_SEPARATOR_SEP '-' 29 #define DEFAULT_LANGUAGE "" 30 #define DEFAULT_COUNTRY "" 31 #define DEFAULT_ENCODING "" 32 33 #include <string> 34 35 using namespace std; 36 37 /** 38 @author Jocelyn Merand 39 */ 40 class Guess{ 41 public: 42 43 /** 44 * Default init 45 */ 46 Guess(); 47 48 /** 49 * Init from a string like [en-UK-utf8] and the rank 50 */ 51 Guess(char * guess_str); 52 53 ~Guess(); 54 55 string GetLanguage(); 56 string GetCountry(); 57 string GetEncoding(); 58 59 bool operator==(string lang); 60 61 protected: 62 string language_str; 63 string country_str; 64 string encoding_str; 65 }; 66 67 #endif 68