Click here to Skip to main content
15,904,500 members

Comments by Andy Rama (Top 5 by date)

Andy Rama 13-May-16 3:13am View    
Hi SA,
Thanks for your comment.
My main goal is to try to develop an application on Ubuntu, similar to Smartboard applications. So as a basic prototype, I am planning to develop an application, in which there will be an area to write/draw anything with default color, default pen size, using mouse as of now.
Later on I want to provide option of erasing, changing color, size, line options etc similar to some paint application.
After that option to import images, videos or other file (presentations).

I know C/C++ on Linux using gcc/g++ compiler and I have quite knowledge of VC++, VC# on Windows. I am new to Qt. I only think that it must be similar to VC++, VC# IDEs.
I am trying to learn Qt, but not understanding in which direction to start so that it will help me to proceed with my basic prototype and can have it intime.

Warm Regards,
Aniket
Andy Rama 2-Jun-12 2:50am View    
Hi Aescleal and all,

Thanks for reply.

Considering that my question is not understandable, below I am explaining it again.
I wanted to design a class or library for parsing any xml-file, named as CXmlParser. This class will have a function ParseXml() to perform actual xml-file parsing. Along with it another class, CXmlTag, to store every xml-tag data.

An external module/application, class name as CExternalCaller, will use above mentioned class/library to parse any xml-file.

CExternalCaller will call ParseXml() of CXmlParser.
Then CXmlParser will do the parsing. But code/action for start-tag and end-tag will not be residing in CXmlParser class.
Instead of that external module i.e. CExternalCaller should decide that behaviour. So any other module/application using same parsing (CXmlParser) can have different behaviour.

This was my problem definition. Interface implementation for CXmlParser (class with pure virtual function) can be one of the solution for it.
But I was trying to implement it using member-function-pointers (for StartTag & EndTag indication) in CXmlParser class which will store addresses of respective functions of caller, i.e. CExternalCaller. There were many problems when I was trying to implement this solution.

Thanks Aescleal, I took help from your post & implement it using template and function-pointer as follows.

//XmlParser
class CXmlParser
{
public :
template<class CALLER>
void ParseXml(const string& rsXmlFile, CALLER* pCaller, void (CALLER::*pfStartTag)(CXmlTag* pTag), void (CALLER::*pfEndTag)(CXmlTag* pTag) );
};

template<class CALLER>
void CXmlReader::ParseXml(const string& rsXmlFile, CALLER* pCaller, void (CALLER::*pfStartTag)(CXmlTag* pTag), void (CALLER::*pfEndTag)(CXmlTag* pTag) )
{
.....
CXmlTag* pXmlTag = new CXmlTag();
.....
//START OF XML-TAG
if( pCaller && pfStartTag )
(pCaller->*pfStartTag)(pXmlTag);
.....
//END OF XML-TAG
if( pCaller && pfEndTag )
(pCaller->*pfEndTag)(pXmlTag);
.....
}



//ExternalCaller
class CExternalCaller
{
public :
void GetData()
{
....
//READ DATA FROM XML
CXmlParser xmlParser;
xmlParser.ParseXml("<xml-file-path>", this, &CExternalCaller::StartTag, &CExternalCaller::EndTag);
....
}

private :
void StartTag(CXmlTag* pTag) {}
void EndTag(CXmlTag* pTag) {}
}



At least now its working as per my requirement. Please let me know if I am wrong anywhere in problem definition or approach.

Thanks & Regards,
Aniket
Andy Rama 2-Jun-12 2:42am View    
Deleted
Hi Aescleal and all,

Thanks for reply.

Considering that my question is not understandable, below I am explaining it again.
I wanted to design a class or library for parsing any xml-file, named as CXmlParser. This class will have a function ParseXml() to perform actual xml-file parsing. Along with it another class, CXmlTag, to store every xml-tag data.

An external module/application, class name as CExternalCaller, will use above mentioned class/library to parse any xml-file.

CExternalCaller will call ParseXml() of CXmlParser.
Then CXmlParser will do the parsing. But code/action for start-tag and end-tag will not be residing in CXmlParser class.
Instead of that external module i.e. CExternalCaller should decide that behaviour. So any other module/application using same parsing (CXmlParser) can have different behaviour.

This was my problem definition. Interface implementation for CXmlParser (CXmlParser class with pure virtual function) can be one of the solution for it.
But I was trying to implement it using member-function-pointers (for StartTag & EndTag indication) in CXmlParser class which will store addresses of respective functions of caller, i.e. CExternalCaller. There were many problems when I was trying to implement this solution.

Thanks Aescleal, I took help from your post & implement it using template and function-pointer as follows.

//XmlParser
class CXmlParser
{
public :
template<class caller="">
void ParseXml(const string& rsXmlFile, CALLER* pCaller, void (CALLER::*pfStartTag)(CXmlTag* pTag), void (CALLER::*pfEndTag)(CXmlTag* pTag) );
};

template<class caller="">
void CXmlReader::ParseXml(const string& rsXmlFile, CALLER* pCaller, void (CALLER::*pfStartTag)(CXmlTag* pTag), void (CALLER::*pfEndTag)(CXmlTag* pTag) )
{
.....
CXmlTag* pXmlTag = new CXmlTag();
.....
//START OF XML-TAG
if( pCaller && pfStartTag )
(pCaller->*pfStartTag)(pXmlTag);
.....
//END OF XML-TAG
if( pCaller && pfEndTag )
(pCaller->*pfEndTag)(pXmlTag);
.....
}



//ExternalCaller
class CExternalCaller
{
public :
void GetData()
{
....
//READ DATA FROM XML
CXmlParser xmlParser;
xmlParser.ParseXml("<xml-file-path>", this, &CExternalCaller::StartTag, &CExternalCaller::EndTag);
....
}

private :
void StartTag(CXmlTag* pTag) {}
void EndTag(CXmlTag* pTag) {}
};


Atleast now its working as per my requirement. Please let me know if I am wrong anywhere in problem definition or approach.

Thanks & Regards,
Aniket
Andy Rama 4-Apr-12 13:38pm View    
Thanks for your reply.
Will you please suggest a book for it? To know the brief idea of building/designing website and testing it.
Andy Rama 10-Mar-12 13:04pm View    
Thanks a lot. It is working with my sample code.