Exemple #1
0
int main(int argc, const char* argv[]) {

	std::string inputString, fString, eString, dString;

	// request a string from the user
	std::cout << "please type the string you would like to by encrypted:" << std::endl;
	std::getline(std::cin, inputString);

	// remove all symbols from the string
	fString = removeSymbols(inputString);

	newLine;

	// encrypt the input string from the user and print it
	eString = encrypt(fString);
	std::cout << "The encrypted string is: " << std::endl << eString << std::endl;

	newLine;

	// decrypt the encrypted string and print it
	dString = decrypt(eString);
	std::cout << "The decrypted string is: " << std::endl << dString << std::endl;

	newLine;

	system("PAUSE");
	return 0;

}
QgsGraduatedSymbolRenderer& QgsGraduatedSymbolRenderer::operator=( const QgsGraduatedSymbolRenderer & other )
{
  if ( this != &other )
  {
    mMode = other.mMode;
    mGeometryType = other.mGeometryType;
    mClassificationField = other.mClassificationField;
    removeSymbols();
    const QList<QgsSymbol*> s = other.symbols();
    for ( QList<QgsSymbol*>::const_iterator it = s.begin(); it != s.end(); ++it )
    {
      addSymbol( new QgsSymbol( **it ) );
    }
    updateSymbolAttributes();
  }

  return *this;
}
Exemple #3
0
int main()
{
    FILE * input = file_new("input.txt","r");
    FILE * output = file_new("output.txt","w");
    char buffer[100000];
    sentence_t * sentence;
    word_t * word;
    fread(buffer,1,100000,input);
    text_t * text = text_new(buffer);
    removeSymbols(buffer);
    text_divide(text);
    int sentences_count = text_getSentencesCount(text);
    for (int i = 0; i < sentences_count; i++)
    {
        sentence = text_getSentence(text,i);
        sentence_divide(sentence);
        int words_count = sentence_getWordsCount(sentence);
        if (words_count < 5) sentence_deleteSentence(sentence);
        else {

                for (int j = 0; j < words_count; j++)
                {
                    word = sentence_getWords(sentence,j);
                    if (word_getWord(word) != NULL) fprintf(output,"%s,",word_getWord(word));
                }

        fprintf(output,"\n");
        }


    }
    word_free(word);
    sentence_free(sentence);
    text_free(text);
    file_free(input);
    file_free(output);
    printf("DONE");
    return 0;
}
Exemple #4
0
bool CFontEngine::openFontFt(const QString &file)
{
    enum ETtfWeight
    {
        TTF_WEIGHT_UNKNOWN = 0,
        TTF_WEIGHT_THIN = 100 + 50,
        TTF_WEIGHT_EXTRALIGHT = 200 + 50,
        TTF_WEIGHT_LIGHT = 300 + 50,
        TTF_WEIGHT_NORMAL = 400 + 50,
        TTF_WEIGHT_MEDIUM = 500 + 50,
        TTF_WEIGHT_SEMIBOLD = 600 + 50,
        TTF_WEIGHT_BOLD = 700 + 50,
        TTF_WEIGHT_EXTRABOLD = 800 + 50,
        TTF_WEIGHT_BLACK = 900 + 50
    };

    bool status = FT_New_Face(itsFt.library, QFile::encodeName(file), 0, &itsFt.face) ? false : true;

    if(status)
        itsFt.open = true;

    PS_FontInfoRec t1info;

    if(0 == FT_Get_PS_Font_Info(itsFt.face, &t1info))
    {
        itsFamily = t1info.family_name;
        itsType = TYPE_1;
    }
    else
    {
        itsFamily = getName(itsFt.face, TT_NAME_ID_FONT_FAMILY);
        itsType = TRUE_TYPE;
    }

    if(itsFamily.isEmpty())
        itsFamily = FT_Get_Postscript_Name(itsFt.face);

    if(itsFamily.isEmpty())
        status = false; // Hmm... couldn't find any of the names!

    if(status)
    {
        removeSymbols(itsFamily);
        itsPsName = (FT_Get_Postscript_Name(itsFt.face));

        if(TYPE_1 == itsType)
        {
            itsWeight = strToWeight(t1info.weight);
            itsItalic = t1info.italic_angle <= -4 || t1info.italic_angle >= 4 ? ITALIC_ITALIC : ITALIC_NONE;
        }
        else // TrueType...
        {
            TT_Postscript *post = NULL;
            TT_OS2 *os2 = NULL;
            TT_Header *head = NULL;
            bool gotItalic = false;

            if(NULL == (os2 = (TT_OS2 *)FT_Get_Sfnt_Table(itsFt.face, ft_sfnt_os2)) || 0xFFFF == os2->version)
                itsWeight = WEIGHT_UNKNOWN;
            else
            {
                FT_UShort weight = (os2->usWeightClass > 0 && os2->usWeightClass < 100) ? os2->usWeightClass * 100 : os2->usWeightClass;

                if(weight < TTF_WEIGHT_THIN)
                    itsWeight = WEIGHT_THIN;
                else if(weight < TTF_WEIGHT_EXTRALIGHT)
                    itsWeight = WEIGHT_EXTRA_LIGHT;
                else if(weight < TTF_WEIGHT_LIGHT)
                    itsWeight = WEIGHT_LIGHT;
                else if(/*weight<TTF_WEIGHT_NORMAL || */ weight < TTF_WEIGHT_MEDIUM)
                    itsWeight = WEIGHT_MEDIUM;
                else if(weight < TTF_WEIGHT_SEMIBOLD)
                    itsWeight = WEIGHT_SEMI_BOLD;
                else if(weight < TTF_WEIGHT_BOLD)
                    itsWeight = WEIGHT_BOLD;
                else if(weight < TTF_WEIGHT_EXTRABOLD)
                    itsWeight = WEIGHT_EXTRA_BOLD;
                else if(weight < TTF_WEIGHT_BLACK)
                    itsWeight = WEIGHT_BLACK;
                else if(os2->fsSelection & (1 << 5))
                    itsWeight = WEIGHT_BOLD;
                else
                    itsWeight = WEIGHT_UNKNOWN;

                itsItalic = os2->fsSelection & (1 << 0) ? ITALIC_ITALIC : ITALIC_NONE;
                gotItalic = true;
            }

            if(WEIGHT_UNKNOWN == itsWeight)
                itsWeight =
                    NULL != (head = (TT_Header *)FT_Get_Sfnt_Table(itsFt.face, ft_sfnt_head)) && head->Mac_Style & 1 ? WEIGHT_BOLD : WEIGHT_MEDIUM;

            if(!gotItalic && (head != NULL || NULL != (head = (TT_Header *)FT_Get_Sfnt_Table(itsFt.face, ft_sfnt_head))))
            {
                gotItalic = true;
                itsItalic = head->Mac_Style & 2 ? ITALIC_ITALIC : ITALIC_NONE;
            }

            if(!gotItalic && NULL != (post = (TT_Postscript *)FT_Get_Sfnt_Table(itsFt.face, ft_sfnt_post)))
            {
                struct TFixed
                {
                    TFixed(unsigned long v) : upper(v >> 16), lower(v & 0xFFFF)
                    {
                    }

                    short upper, lower;

                    float value()
                    {
                        return upper + (lower / 65536.0);
                    }
                };

                gotItalic = true;
                itsItalic = 0.0f == ((TFixed)post->italicAngle).value() ? ITALIC_NONE : ITALIC_ITALIC;
            }
        }
    }
Exemple #5
0
Token::Token(string s) {
	candidates.clear();
	removeSymbols(s, separators_text); //elimina secuencias de simbolos, no los individuales
	split(candidates, s, delimiters);
	this->constructTerms();
}