Esempio n. 1
0
NRectangle::NRectangle(const NPoint &position, const NSize &size)
{
	NPoint *p = (NPoint *)&position;
	NSize *s = (NSize *)&size;
	x = p->GetX();
	y = p->GetY();
	width = s->GetWidth();
	height = s->GetHeight();
}
Esempio n. 2
0
void HelpClass::Deserialize(const Serializator &s)
{
	Text *oldtext = atext;
	DateTime *olddatetime = adatetime;
	NObjectCollection *oldnobjectcollection = nobjectcollection;
	NObjectDictionary *oldnobjectdictionary = nobjectdictionary;
	Buffer *oldbuffer = abuffer;
	TextBuffer *oldtextbuffer = atextbuffer;
	NBool *oldnnbool = nnbool;
	NChar *oldnnchar = nnchar;
	NWChar *oldnnwchar = nnwchar;
	NShort *oldnnshort = nnshort;
	NInt *oldnnint = nnint;
	NLong *oldnnlong = nnlong;
	NLongLong *oldnnlonglong = nnlonglong;
	NUChar *oldnnuchar = nnuchar;
	NUShort *oldnnushort = nnushort;
	NUInt *oldnnuint = nnuint;
	NULong *oldnnulong = nnulong;
	NULongLong *oldnnulonglong = nnulonglong;
	NFloat *oldnnfloat = nnfloat;
	NDouble *oldnndouble = nndouble;
	NLongDouble *oldnnlongdouble = nnlongdouble;
	NSize *oldnnsize = nnsize;
	NPoint *oldnnpoint = nnpoint;
	NRectangle *oldnnrectangle = nnrectangle;
	NColor *oldnncolor = nncolor;
	
	nbool = ((Serializator *)&s)->GetBool();
	nchar = ((Serializator *)&s)->GetChar();
	nshort = ((Serializator *)&s)->GetShort();
	nint = ((Serializator *)&s)->GetInt();
	nlong = ((Serializator *)&s)->GetLong();
	nlonglong = ((Serializator *)&s)->GetLongLong();
	nuchar = ((Serializator *)&s)->GetUChar();
	nushort = ((Serializator *)&s)->GetUShort();
	nuint = ((Serializator *)&s)->GetUInt();
	nulong = ((Serializator *)&s)->GetULong();
	nulonglong = ((Serializator *)&s)->GetULongLong();
	nfloat = ((Serializator *)&s)->GetFloat();
	ndouble = ((Serializator *)&s)->GetDouble();
	nlongdouble = ((Serializator *)&s)->GetLongDouble();
	
	nnbool = (NBool *)((Serializator *)&s)->GetNObject();
	nnchar = (NChar *)((Serializator *)&s)->GetNObject();
	nnwchar = (NWChar *)((Serializator *)&s)->GetNObject();
	nnshort = (NShort *)((Serializator *)&s)->GetNObject();
	nnint = (NInt *)((Serializator *)&s)->GetNObject();
	nnlong = (NLong *)((Serializator *)&s)->GetNObject();
	nnlonglong = (NLongLong *)((Serializator *)&s)->GetNObject();
	nnuchar = (NUChar *)((Serializator *)&s)->GetNObject();
	nnushort = (NUShort *)((Serializator *)&s)->GetNObject();
	nnuint = (NUInt *)((Serializator *)&s)->GetNObject();
	nnulong = (NULong *)((Serializator *)&s)->GetNObject();
	nnulonglong = (NULongLong *)((Serializator *)&s)->GetNObject();
	nnfloat = (NFloat *)((Serializator *)&s)->GetNObject();
	nndouble = (NDouble *)((Serializator *)&s)->GetNObject();
	nnlongdouble = (NLongDouble *)((Serializator *)&s)->GetNObject();
	nnsize = (NSize *)((Serializator *)&s)->GetNObject();
	nnpoint = (NPoint *)((Serializator *)&s)->GetNObject();
	nnrectangle = (NRectangle *)((Serializator *)&s)->GetNObject();
	nncolor = (NColor *)((Serializator *)&s)->GetNObject();
	
	atext = (Text *)((Serializator *)&s)->GetNObject();
	adatetime = (DateTime *)((Serializator *)&s)->GetNObject();

	nobjectcollection = (NObjectCollection *)((Serializator *)&s)->GetNObject();
	nobjectdictionary = (NObjectDictionary *)((Serializator *)&s)->GetNObject();
	abuffer = (Buffer *)((Serializator *)&s)->GetNObject();
	atextbuffer = (TextBuffer *)((Serializator *)&s)->GetNObject();
	
	if (nbool != true || 
		nchar != 1 || nshort != 2 || nint != 3 || nlong != 4 || nlonglong != 5 ||
		nuchar != 6 || nushort != 7 || nuint != 8 || nulong != 9 || nulonglong != 10 ||
		nfloat != 11 || ndouble != 12 || nlongdouble != 13)
		{
			throw new Exception("Numbers not propertly deserializated", __FILE__, __LINE__, __func__);
		}
	
	if (nnbool->Value() != true) throw new Exception("NBool::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnchar->Value() != 'c') throw new Exception("NChar::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnwchar->Value() != L'd') throw new Exception("NWChar::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnshort->Value() != -22000) throw new Exception("NShort::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnint->Value() != -34000) throw new Exception("NInt::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnlong->Value() != -22000000000) throw new Exception("NLong::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnlonglong->Value() != -44000000000000) throw new Exception("NLongLong::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnuchar->Value() != 'c') throw new Exception("NUChar::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnushort->Value() != 44000) throw new Exception("NUShort::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnuint->Value() != 88000) throw new Exception("NUInt::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnulong->Value() != 44000000000) throw new Exception("NULong::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnulonglong->Value() != 88000000000000L) throw new Exception("NULongLong::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnfloat->Value() != -1e15f) throw new Exception("NFloat::Deserialize error", __FILE__, __LINE__, __func__);
	if (nndouble->Value() != -1e40) throw new Exception("NDouble::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnlongdouble->Value() != -1e400L) throw new Exception("NLongDouble::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnsize->GetWidth() != 400) throw new Exception("NNSize::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnsize->GetHeight() != 300) throw new Exception("NNSize::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnpoint->GetX() != 3) throw new Exception("NPoint::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnpoint->GetY() != 4) throw new Exception("NPoint::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnrectangle->GetX() != 4) throw new Exception("NRectangle::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnrectangle->GetY() != 5) throw new Exception("NRectangle::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnrectangle->GetWidth() != 6) throw new Exception("NRectangle::Deserialize error", __FILE__, __LINE__, __func__);
	if (nnrectangle->GetHeight() != 7) throw new Exception("NRectangle::Deserialize error", __FILE__, __LINE__, __func__);
	if (nncolor->R() != 1 || nncolor->G() != 0 || nncolor->B() != 0 || nncolor->A() != 0.5)
		throw new Exception("NColor::Deserialize error", __FILE__, __LINE__, __func__);
	
	if (oldnnbool->Value() != nnbool->Value()) throw new Exception("NBool::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnchar->Value() != nnchar->Value()) throw new Exception("NChar::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnwchar->Value() != nnwchar->Value()) throw new Exception("NWChar::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnshort->Value() != nnshort->Value()) throw new Exception("NShort::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnint->Value() != nnint->Value()) throw new Exception("NInt::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnlong->Value() != nnlong->Value()) throw new Exception("NLong::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnlonglong->Value() != nnlonglong->Value()) throw new Exception("NLongLong::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnuchar->Value() != nnuchar->Value()) throw new Exception("NUChar::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnushort->Value() != nnushort->Value()) throw new Exception("NUShort::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnuint->Value() != nnuint->Value()) throw new Exception("NUInt::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnulong->Value() != nnulong->Value()) throw new Exception("NULong::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnulonglong->Value() != nnulonglong->Value()) throw new Exception("NULongLong::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnfloat->Value() != nnfloat->Value()) throw new Exception("NFloat::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnndouble->Value() != nndouble->Value()) throw new Exception("NDouble::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnlongdouble->Value() != nnlongdouble->Value()) throw new Exception("NLongDouble::Deserialize error", __FILE__, __LINE__, __func__);
	if (oldnnsize->GetWidth() != nnsize->GetWidth()) throw new Exception("NSize::Deserialize error", __FILE__, __LINE__, __func__);
	if (!oldnnpoint->Equals(*nnpoint)) throw new Exception("NPoint::Deserialize error", __FILE__, __LINE__, __func__);
	if (!oldnnrectangle->Equals(*nnrectangle)) throw new Exception("NRectangle::Deserialize error", __FILE__, __LINE__, __func__);
	if (!oldnncolor->Equals(*nncolor)) throw new Exception("NColor::Deserilize error", __FILE__, __LINE__, __func__);
	
	if (*oldtext != *atext) 
		throw new Exception("Text not propertly deserializated", __FILE__, __LINE__, __func__);
	if (*olddatetime != *adatetime)
		throw new Exception("DateTime not propertly deserializated", __FILE__, __LINE__, __func__);
	if (oldnobjectcollection->ToText() != nobjectcollection->ToText())
		throw new Exception("NObjectCollection not propertly deserializated", __FILE__, __LINE__, __func__);
	if (oldnobjectdictionary->ToText() != nobjectdictionary->ToText())
		throw new Exception("NObjectDictionary not propertly deserializated", __FILE__, __LINE__, __func__);
	if (*oldbuffer != *abuffer)
		throw new Exception("Buffer not propertly deserializated", __FILE__, __LINE__, __func__);
	if (oldtextbuffer->ToText() != atextbuffer->ToText())
		throw new Exception("TextBuffer not propertly deserializated", __FILE__, __LINE__, __func__);
		
	oldnobjectcollection->DeleteAndClear();
	oldnobjectdictionary->DeleteAndClear();
	delete oldtext;
	delete olddatetime;
	delete oldnobjectcollection;
	delete oldnobjectdictionary;
	delete oldbuffer;
	delete oldtextbuffer;
	delete oldnnbool;
	delete oldnnchar;
	delete oldnnwchar;
	delete oldnnshort;
	delete oldnnint;
	delete oldnnlong;
	delete oldnnlonglong;
	delete oldnnuchar;
	delete oldnnushort;
	delete oldnnuint;
	delete oldnnulong;
	delete oldnnulonglong;
	delete oldnnfloat;
	delete oldnndouble;
	delete oldnnlongdouble;
	delete oldnnsize;
	delete oldnnpoint;
	delete oldnnrectangle;
	delete oldnncolor;
}
Esempio n. 3
0
NPoint::NPoint( const NPoint & that ):
p_( new Private( that.x(), that.y() ) ) {
}
Esempio n. 4
0
bool operator==(NPoint p1, NPoint p2) {
	return p1.x() == p2.x() && p1.y() == p2.y();
}
Esempio n. 5
0
/*
 * \brief Checks if given point is in nxt lcd.
 */
bool pointInLcd(NPoint p) {
	return LCD::pixelInLcd(p.x(), p.y());
}
Esempio n. 6
0
	NPoint operator-=(NPoint point) {
		xVal -= point.x();
		yVal -= point.y();
		return *this;
	}
Esempio n. 7
0
const NPoint operator-(NPoint p1, NPoint p2) {
	return NPoint(p1.x() - p2.x(), p2.y() - p2.y());
}
Esempio n. 8
0
bool NRectangle::Contains(const NPoint &p)
{
	NPoint *pp = (NPoint *)&p;
	return Contains(pp->GetX(), pp->GetY());
}
GraphicsPatternRadial::GraphicsPatternRadial(const NPoint &a, double radiusa, const NPoint &b, double radiusb)
{
	NPoint *aa = (NPoint *)&a;
	NPoint *bb = (NPoint *)&b;
	pattern = cairo_pattern_create_radial(aa->GetX(), aa->GetY(), radiusa, bb->GetX(), bb->GetY(), radiusb);
}