示例#1
0
std::auto_ptr<ElementoLexico> ProwlLexer::getSigElemento()
{
    std::string token;
    std::auto_ptr<ElementoLexico> toret( GeneralLexer::getSigElemento() );

    if ( dynamic_cast<NoIdentificado *>( toret.get() ) != NULL ) {
        unsigned int linea = toret->getLinea();
        unsigned int columna = toret->getColumna();

        if ( Operadores.find( getCaracterActual() ) != std::string::npos ) {
            token.push_back( getCaracterActual() );
            toret.reset( new Operador( token, linea, columna ) );

            avanzar();
        }
        else
        if ( chkSig( Begin ) ) {
            toret.reset( new AperturaDeBloque( linea, columna ) );
            avanzar( Begin.length() );
        }
        else
        if ( chkSig( End ) ) {
            toret.reset( new CierreDeBloque( linea, columna ) );
            avanzar( End.length() );
        }
    }

    return toret;
}
示例#2
0
string replaceI(const string& str, const string& pattern, const string& repl)
{
  string op(tolower(str));
  string toret(str);
  unsigned long plen = pattern.length();
  unsigned long replen = repl.length();
  unsigned long lastpos = 0;
  unsigned long f = 0;
	
  while((f = op.find(tolower(pattern), lastpos)) != string::npos ) {
    toret.replace(f, plen, repl);
    lastpos = f + replen;
  }
  
  return toret;
}
示例#3
0
QColor  ToyStream::toycolor2QColor(QString toycolor)
{
  QChar a, b;
  QString alp;
  qDebug() << toycolor;
  if (toycolor.size() == 8) {
    alp[0] = toycolor[0];
    alp[1] = toycolor[1];
    toycolor.remove(0, 2);
  }
  a = toycolor[0];
  b = toycolor[1];
  toycolor[0] = toycolor[4];
  toycolor[1] = toycolor[5];
  toycolor[4] = a;
  toycolor[5] = b;
  QColor toret("#" + toycolor);
  if (alp.isEmpty() == false)
    toret.setAlpha(alp.toInt((bool*) 0, 16));
  return toret;
}