亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gsm_parser.c

?? Gsm手機(短信息,電話簿)開發庫C++源代碼
?? C
字號:
// *************************************************************************
// * GSM TA/ME library
// *
// * File:    gsm_parser.cc
// *
// * Purpose: Parser to parse MA/TA result strings
// *
// * Author:  Peter Hofmann (software@pxh.de)
// *
// * Created: 13.5.1999
// *************************************************************************

#ifdef HAVE_CONFIG_H
#include <gsm_config.h>
#endif
#include <gsmlib/gsm_parser.h>
#include <gsmlib/gsm_nls.h>
#include <ctype.h>
#include <assert.h>
#include <strstream>

using namespace std;
using namespace gsmlib;

// Parser members

int Parser::nextChar(bool skipWhiteSpace)
{
  if (skipWhiteSpace)
    while (_i < _s.length() && isspace(_s[_i])) ++_i;

  if (_i == _s.length())
  {
    _eos = true;
    return -1;
  }

  return _s[_i++];
}
    
bool Parser::checkEmptyParameter(bool allowNoParameter) throw(GsmException)
{
  int c = nextChar();
  if (c == ',' || c == -1)
    if (allowNoParameter)
    {
      putBackChar();
      return true;
    }
    else
      throwParseException(_("expected parameter"));

  putBackChar();
  return false;
}
    
string Parser::parseString2(bool stringWithQuotationMarks)
  throw(GsmException)
{
  int c;
  string result;
  if (parseChar('"', true))  // OK, string starts and ends with quotation mark
    if (stringWithQuotationMarks)
    {
      // read till end of line
      while ((c = nextChar(false)) != -1)
        result += c;
      
      // check for """ at end of line
      if (result.length() == 0 || result[result.length() - 1]  != '"')
        throwParseException(_("expected '\"'"));
      
      // remove """ at the end
      result.resize(result.length() - 1);
    }
    else
    {
      // read till next """
      while ((c = nextChar(false)) != '"')
        if (c == -1)
          throwParseException();
        else
          result += c;
    }
  else                          // string ends with "," or EOL
  {
    c = nextChar(false);
    while (c != ',' && c != -1)
    {
      result += c;
      c = nextChar(false);
    }
    if (c == ',') putBackChar();
  }
    
  return result;
}

int Parser::parseInt2() throw(GsmException)
{
  string s;
  int c;
  int result;

  while (isdigit(c = nextChar())) s += c;

  putBackChar();
  if (s.length() == 0)
    throwParseException(_("expected number"));

  istrstream is(s.c_str());
  is >> result;
  return result;
}

void Parser::throwParseException(string message) throw(GsmException)
{
  ostrstream os;
  if (message.length() == 0)
    throw GsmException(stringPrintf(_("unexpected end of string '%s'"),
                                    _s.c_str()), ParserError);
  else
    throw GsmException(message +
                       stringPrintf(_(" (at position %d of string '%s')"), _i,
                                    _s.c_str()), ParserError);
}

Parser::Parser(string s) : _i(0), _s(s), _eos(false)
{
}

bool Parser::parseChar(char c, bool allowNoChar) throw(GsmException)
{
  if (nextChar() != c)
    if (allowNoChar)
    {
      putBackChar();
      return false;
    }
    else
      throwParseException(stringPrintf(_("expected '%c'"), c));
  return true;
}

vector<string> Parser::parseStringList(bool allowNoList)
  throw(GsmException)
{
  // handle case of empty parameter
  vector<string> result;
  if (checkEmptyParameter(allowNoList)) return result;

  parseChar('(');
  if (nextChar() != ')')
  {
    putBackChar();
    while (1)
    {
      result.push_back(parseString());
      int c = nextChar();
      if (c == ')')
      break;
      if (c == -1)
        throwParseException();
      if (c != ',')
        throwParseException(_("expected ')' or ','"));
    }
  }
  
  return result;
}

vector<bool> Parser::parseIntList(bool allowNoList)
  throw(GsmException)
{
  // handle case of empty parameter
  bool isRange = false;
  vector<bool> result;
  int resultCapacity = 0;
  unsigned int saveI = _i;

  if (checkEmptyParameter(allowNoList)) return result;

  // check for the case of a integer list consisting of only one parameter
  // some TAs omit the parentheses in this case
  if (isdigit(nextChar()))
  {
    putBackChar();
    int num = parseInt();
    result.resize(num + 1, false);
    result[num] = true;
    return result;
  }
  putBackChar();

  // run in two passes
  // pass 0: find capacity needed for result
  // pass 1: resize result and fill it in
  for (int pass = 0; pass < 2; ++pass)
  {
    if (pass == 1)
    {
      _i = saveI;
      result.resize(resultCapacity + 1, false);
    }

    parseChar('(');
    if (nextChar() != ')')
    {
      putBackChar();
      int lastInt = -1;
      while (1)
      {
        int thisInt = parseInt();

        if (isRange)
        {
          assert(lastInt != -1);
          if (lastInt <= thisInt)
            for (int i = lastInt; i < thisInt; ++i)
            {
              if (i > resultCapacity)
                resultCapacity = i;
              if (pass == 1)
                result[i] = true;
            }
          else
            for (int i = thisInt; i < lastInt; ++i)
            {
              if (i > resultCapacity)
                resultCapacity = i;
              if (pass == 1)
                result[i] = true;
            }
          isRange = false;
        }

        if (thisInt > resultCapacity)
          resultCapacity = thisInt;
        if (pass == 1)
          result[thisInt] = true;
        lastInt = thisInt;
      
        int c = nextChar();
        if (c == ')')
          break;

        if (c == -1)
          throwParseException();

        if (c != ',' && c != '-')
          throwParseException(_("expected ')', ',' or '-'"));

        if (c == ',')
          isRange = false;
        else                      // is '-'
          if (isRange)
            throwParseException(_("range of the form a-b-c not allowed"));
          else
            isRange = true;
      }
    }
  }
  if (isRange)
    throwParseException(_("range of the form a- no allowed"));
  return result;
}

IntRange Parser::parseRange(bool allowNoRange)
  throw(GsmException)
{
  // handle case of empty parameter
  IntRange result;
  if (checkEmptyParameter(allowNoRange)) return result;

  parseChar('(');
  result._low = parseInt();
  parseChar('-');
  result._high = parseInt();
  parseChar(')');

  return result;
}

int Parser::parseInt(bool allowNoInt) throw(GsmException)
{
  // handle case of empty parameter
  int result = NOT_SET;
  if (checkEmptyParameter(allowNoInt)) return result;

  result = parseInt2();

  return result;
}

string Parser::parseString(bool allowNoString,
                           bool stringWithQuotationMarks)
  throw(GsmException)
{
  // handle case of empty parameter
  string result;
  if (checkEmptyParameter(allowNoString)) return result;

  result = parseString2(stringWithQuotationMarks);

  return result;
}

bool Parser::parseComma(bool allowNoComma) throw(GsmException)
{
  if (nextChar() != ',')
    if(allowNoComma)
    {
      putBackChar();
      return false;
    }
    else
      throwParseException(_("expected comma"));
  return true;
}

string Parser::parseEol() throw(GsmException)
{
  string result;
  int c;
  while ((c = nextChar()) != -1) result += c;
  return result;
}

void Parser::checkEol() throw(GsmException)
{
  if (nextChar() != -1)
  {
    putBackChar();
    throwParseException(_("expected end of line"));
  }
}

string Parser::getEol()
{
  string result;
  int c;
  unsigned int saveI = _i;
  bool saveEos = _eos;
  while ((c = nextChar()) != -1) result += c;
  _i = saveI;
  _eos = saveEos;
  return result;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区四区五区黄| 欧美日韩一区二区三区高清 | 欧美性色综合网| 欧美aaaaaa午夜精品| 国产精品福利一区二区| 欧美一级黄色大片| av在线不卡免费看| 捆绑紧缚一区二区三区视频| 亚洲欧美视频在线观看视频| 国产亚洲精品超碰| 日韩亚洲欧美高清| 欧美视频自拍偷拍| 972aa.com艺术欧美| 国产精品亚洲人在线观看| 香蕉av福利精品导航| 亚洲欧美日韩在线不卡| 国产日本欧洲亚洲| 久久综合九色综合欧美98| 欧美日韩国产首页| 色丁香久综合在线久综合在线观看| 国产综合色产在线精品| 日本在线播放一区二区三区| 亚洲精品美国一| 中文字幕在线播放不卡一区| 久久影院视频免费| 精品免费视频一区二区| 这里是久久伊人| 欧美日韩精品一区二区三区蜜桃| 国产成人亚洲精品青草天美| 毛片基地黄久久久久久天堂| 天堂成人免费av电影一区| 一区二区三区免费看视频| 一区二区免费看| 亚洲精品免费视频| 亚洲一级电影视频| 亚洲综合无码一区二区| 亚洲蜜臀av乱码久久精品蜜桃| 国产精品久久久久国产精品日日| 欧美经典一区二区三区| 久久日韩精品一区二区五区| 精品国产91洋老外米糕| 精品国产一区a| 精品91自产拍在线观看一区| 精品国产髙清在线看国产毛片| 欧美不卡一区二区| 久久日一线二线三线suv| 国产日韩影视精品| 国产精品麻豆久久久| 亚洲欧美中日韩| 亚洲精品国产精华液| 亚洲午夜成aⅴ人片| 三级久久三级久久| 久久精品国产精品青草| 国产乱码精品一区二区三区av | 中文一区一区三区高中清不卡| 亚洲精品在线观看网站| 久久免费精品国产久精品久久久久| 国产性做久久久久久| 国产欧美综合在线| 亚洲品质自拍视频| 日韩在线一区二区| 久久99精品国产麻豆婷婷| 五月天中文字幕一区二区| 秋霞国产午夜精品免费视频| 精品一区二区影视| 风流少妇一区二区| 91福利国产精品| 日韩免费在线观看| 国产精品免费网站在线观看| 亚洲久本草在线中文字幕| 亚洲国产精品久久艾草纯爱| 久久99精品国产.久久久久 | 日本高清不卡在线观看| 欧美在线|欧美| 日韩精品一区二区三区视频播放| 国产亚洲一本大道中文在线| 亚洲精品国产无天堂网2021| 奇米色777欧美一区二区| 国产69精品久久777的优势| 91啪亚洲精品| 欧美电视剧在线看免费| 亚洲欧洲日本在线| 日韩电影在线观看网站| 丁香五精品蜜臀久久久久99网站 | 欧美极品aⅴ影院| 午夜激情综合网| 国产精品88av| 欧美日韩亚洲综合在线| 国产区在线观看成人精品| 亚洲国产成人91porn| 国产91精品一区二区麻豆亚洲| 欧美日精品一区视频| 2021中文字幕一区亚洲| 亚洲一区在线看| 成人免费高清视频在线观看| 欧美一级欧美三级在线观看| 亚洲三级视频在线观看| 国产原创一区二区三区| 欧美三级中文字| 中文字幕第一区第二区| 美女在线一区二区| 欧美在线你懂的| 亚洲婷婷在线视频| 国产成人亚洲综合a∨猫咪| 91精品国产综合久久久久久久久久 | 亚洲国产乱码最新视频 | 日韩一卡二卡三卡四卡| 亚洲欧美偷拍卡通变态| 成人综合婷婷国产精品久久免费| 欧美日韩一区二区三区视频 | 日韩毛片精品高清免费| 久久国产福利国产秒拍| 欧美日韩高清一区二区三区| 综合欧美一区二区三区| 国产成人免费9x9x人网站视频| 日韩午夜激情电影| 日韩va亚洲va欧美va久久| 欧美性色欧美a在线播放| 亚洲婷婷综合色高清在线| 国产成人精品三级麻豆| 日韩欧美美女一区二区三区| 丝袜脚交一区二区| 欧美日本一区二区三区| 一区二区免费看| 在线观看区一区二| 亚洲自拍都市欧美小说| 99久久国产免费看| 一区免费观看视频| av亚洲精华国产精华| 国产精品免费视频网站| 高清国产一区二区| 轻轻草成人在线| 国产精选一区二区三区| 精品久久久久久久人人人人传媒| 亚洲国产欧美另类丝袜| 欧美精品一二三| 日韩精品久久理论片| 91精品国产综合久久精品性色| 亚洲成人午夜影院| 欧美精品少妇一区二区三区| 婷婷成人综合网| 8x8x8国产精品| 麻豆91免费观看| 2017欧美狠狠色| 成人激情动漫在线观看| 国产精品视频一二| 色综合一个色综合亚洲| 一区二区三区在线影院| 欧美日韩午夜在线视频| 日韩av电影免费观看高清完整版 | 国产三级久久久| 欧美亚日韩国产aⅴ精品中极品| 欧美色综合影院| 国产在线精品一区二区三区不卡| 中文字幕欧美一| 精品欧美久久久| 在线观看av一区| 91小视频在线免费看| 国产一区二区日韩精品| 日本aⅴ免费视频一区二区三区| 一区二区三区不卡在线观看 | 成+人+亚洲+综合天堂| 欧洲精品在线观看| 亚洲国产成人高清精品| 日韩一区二区三| 国产精品88888| 亚洲免费在线播放| 884aa四虎影成人精品一区| 美女脱光内衣内裤视频久久网站| 精品久久久久99| 不卡的看片网站| 夜夜精品视频一区二区| 欧美一区二区福利在线| 丁香天五香天堂综合| 一区二区欧美国产| 久久综合久久综合久久| 在线视频你懂得一区二区三区| 免费一级欧美片在线观看| 欧美国产一区二区| 欧美日韩三级在线| 国产成人精品午夜视频免费| 亚洲综合色噜噜狠狠| 亚洲精品一区二区三区99| 99精品欧美一区二区三区小说| 午夜久久久影院| 亚洲国产精品激情在线观看| 欧美日韩情趣电影| 国产激情一区二区三区桃花岛亚洲| 一区二区三区欧美| www成人在线观看| 欧美日韩一区二区三区在线看| 懂色av中文一区二区三区| 奇米亚洲午夜久久精品| 亚洲免费观看高清| 久久精品人人做人人爽97| 欧美精品在线一区二区三区| 成人av电影在线| 国产在线不卡视频| 亚洲国产精品欧美一二99| 自拍偷拍国产亚洲|