Jump to content

  • Log In with Google      Sign In   
  • Create Account


nuclear123

Member Since 05 Feb 2010
Offline Last Active Oct 05 2012 02:28 PM
**---

Posts I've Made

In Topic: C++ ODBC Wrapper Classes ( SQLHANDLES ) - part 1

02 August 2012 - 11:44 PM

thank you i will rid of it. I was thinking it meant self documentation and to prevent virtual functions from being included within the code but it seems from msdn it just prevents initialization of the vtable within the constructor to prevent wasting time of initializing something that might get overwritten later from deeper inheritance( if i understood it correctly )

In Topic: The Curiously Recurring Template Pattern help

02 August 2012 - 03:02 AM

so in other words CRTP would be correctly used like the following



template <class Derived>
struct base
{
public:
// some reason this function is not getting called
	void implementation()
	{
		 _asm int 3;
				 static_cast<Derived*>(this)->implementation();
				 // ...
	}
};

struct derived : base<derived>
{
		 void implementation()
		 {
				  _asm int 3;
		 }
};

int main()
{
	 base<derived> test;
	 test.implementation();
	 return 0;
}

I'm still a little confused one one thing. What causes this to be better performance than VTABLE referencing? to me i still see levels of indirection to get to the derived classes function from the base class

In Topic: Array of Arrays?

22 July 2012 - 01:04 PM

I need to dynamically add rows and im using C++.

FastCall22 - I will look at your post and see if it's what im looking for

In Topic: how to return different types?

24 February 2012 - 12:17 AM

This is all im trying to do:
1.) Have a function that can detect and effectively parse 2 diffrent possible XML messages. Upon return the XML we be stored in the appropriate struct and returned by the function. I can then have the caller somehow know the type that was returned and handle the struct according to its type. Here is my code if this helps


QList<CError> ParseError(QXmlStreamReader& streamReader)
{
QList<CError> errorList;
CError errorBuffer;

streamReader.readNext();
while (!(streamReader.tokenType() == QXmlStreamReader::EndElement && streamReader.name() == "ErrorMessage")) {
if (streamReader.tokenType() == QXmlStreamReader::StartElement) {
if (streamReader.name() == "Title") {
errorBuffer.strTitle = streamReader.readElementText();
}
if (streamReader.name() == "Message") {
errorBuffer.strMessage = streamReader.readElementText();
}
}
streamReader.readNext();
}
errorList.append(errorBuffer);
return errorList;
}

QList<CSubscription> ParseSubscription(QXmlStreamReader& streamReader)
{
QList<CSubscription> subscriptionList;
CSubscription subscriptionBuffer;

streamReader.readNext();
while (streamReader.tokenType() != QXmlStreamReader::EndDocument) {
while (!(streamReader.tokenType() == QXmlStreamReader::EndElement && streamReader.name() == "Subscription")) {
if (streamReader.tokenType() == QXmlStreamReader::StartElement) {
if (streamReader.name() == "NewestVersion") {
subscriptionBuffer.strNewestVersion = streamReader.readElementText();
}
if (streamReader.name() == "ProductName") {
subscriptionBuffer.strGame = streamReader.readElementText();
}
if (streamReader.name() == "ExpiryDate") {
subscriptionBuffer.strExpireDate = streamReader.readElementText();
}
if (streamReader.name() == "Detection") {
subscriptionBuffer.strDetection = streamReader.readElementText();
}
}
streamReader.readNext();
}
subscriptionList.append(subscriptionBuffer);
}
return subscriptionList;
}


QList<EITHERSTRUCT> ParseXML(QString& strXML)
{
QXmlStreamReader streamReader(strXML);

while (!streamReader.atEnd()) {
QXmlStreamReader::TokenType token = streamReader.readNext();
if(token == QXmlStreamReader::StartDocument) {
continue;
}
if(token == QXmlStreamReader::StartElement) {
if (streamReader.name() == "ErrorMessage") {
return ParseError(streamReader);
}
  if (streamReader.name() == "Subscription") {
return ParseSubscription(streamReader);
  }
}
}
return SOME_ERROR;
}

In Topic: .lib Dependency question

08 February 2012 - 01:10 PM

my custom.lib isnt complete until the added fucionality of the other public .lib is used.

PARTNERS