示例#1
0
void CXXCircle::trimOwnNodes(){    
	
	//Delete all nodes that lie within any of the segments
    list<CXXCircle, CXX::CXXAlloc<CXXCircle> > &otherCircles = theParent->getCircles();
	int nodesToDraw = countDrawnNodes();
	list<CXXCircle, CXX::CXXAlloc<CXXCircle> >::iterator otherCirclesEnd = otherCircles.end();
	for (list<CXXCircle, CXX::CXXAlloc<CXXCircle> >::iterator otherCircleIter = otherCircles.begin();
		 otherCircleIter != otherCirclesEnd && nodesToDraw > 0;
		 ++otherCircleIter){
		CXXCircle &otherCircle (*otherCircleIter);
		if (!otherCircle.getEaten()  &&
			&otherCircle != this){
			list<CXXCircleNode, CXX::CXXAlloc<CXXCircleNode> >::iterator nodesEnd = theNodes.end();
			for (list<CXXCircleNode, CXX::CXXAlloc<CXXCircleNode> >::iterator nodeIter = theNodes.begin();
				 nodeIter != nodesEnd && nodesToDraw>0;
				 ++nodeIter){
				CXXCircleNode &nodec(*nodeIter);
				if (nodec.getOtherCircle() != &otherCircle){
					if (nodec.isDeleted() == 0){
						if (!otherCircle.accIsBehind(nodec.getCoord())){
							nodec.setDeleted(1);
							nodesToDraw--;
						}
					}
				}
			}
		}
	}
	return;
}
示例#2
0
vector<string> decrypt (vector<string> cipher, string keystr, primenc_et contprimenc, contenc_et contsecenc)
{
    byte primdecarr[CIPHERLEN*20+1];
    uint32_t i;
    vector<string> decvec;
    for(i=0;i<cipher.size();i++){
        if(NO_PRIMENC == contprimenc){
            nodec(primdecarr, cipher[i]);
        }else if(BASE64 == contprimenc){
            base64dec(primdecarr, cipher[i]);
        }else if(BASE32 == contprimenc){
            base32dec(primdecarr, cipher[i]);
        }else if(BASE16 == contprimenc){
            base16dec(primdecarr, cipher[i]);
        }else{
            throw contprimenc;
            cout << "This primary encoding is not supported yet." << endl;
        }

        if(NO_CONTENC == contsecenc){
            decvec.push_back(nocrypt(primdecarr));
        }else if(AES_128 == contsecenc){
            decvec.push_back(AESdec(primdecarr, keystr));
        }else{
            throw contsecenc;
            cout << "This secondary encoding is not supported yet." << endl;
        }

    }

    return decvec;
}
示例#3
0
vector<string> encrypt (vector<string> clrtxt, string keystr, primenc_et contprimenc, contenc_et contsecenc)
{
    byte primencarr[CIPHERLEN*2+10];
    uint32_t i;
    vector<string> encvec;

    for(i=0;i<clrtxt.size();i++){
        if(NO_CONTENC == contsecenc){
            nodec(primencarr, clrtxt[i]);
        }else if(AES_128 == contsecenc){
            AESencs(primencarr, clrtxt[i], keystr);
        }else{
            cout << "This secondary encoding is not supported yet." << endl;
            throw contsecenc;
        }

        if(NO_PRIMENC == contprimenc){
            encvec.push_back(nocrypt(primencarr));
        }else if(BASE64 == contprimenc){
            encvec.push_back(base64enc(primencarr, CIPHERLEN));
        }else if(BASE32 == contprimenc){
            encvec.push_back(base32enc(primencarr, CIPHERLEN));
        }else if(BASE16 == contprimenc){
            encvec.push_back(base16enc(primencarr, CIPHERLEN));
        }else{
            cout << "This primary encoding is not supported yet." << endl;
            throw contprimenc;
        }

    }
    return encvec;
}
示例#4
0
void nodec(byte* dec, string nocodstr)
{
    nodec((byte*) dec, (byte*) nocodstr.c_str(), nocodstr.size());
}