<div dir="ltr">Thanks.<div style>Current env need to use C++ APIs and i cannot use python.</div><div style>So can i get help in understanding the data structure relation ...</div><div style>From CXXRecordDecl i get FieldDecl....now how to analyse further on each FieldDecl?</div>
<div style>FieldDecl is DeclaratorDecl...from this how can i get CTemplateDecl...</div><div style>I tried using DeclContext...also tried using getType....</div><div style>I could get CXXRecordDecl...but when i used getDescribedClassTemplates ...it returned NULL...</div>
<div style>So am stuck here.</div><div style><br></div><div style>Pls guide me how to handle from here.</div><div style><br></div><div style>regard</div><div style>ragha</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, May 29, 2013 at 4:02 PM, Matthieu Brucher <span dir="ltr"><<a href="mailto:matthieu.brucher@gmail.com" target="_blank">matthieu.brucher@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,<div><br></div><div>I made something like that in the past, but with gccxml, and I more or less achieved the same thing with pyclang.</div><div>I made a free function called encode() and a decode() for usual data types, and then I use my small script (<a href="https://github.com/mbrucher/clang2xml" target="_blank">https://github.com/mbrucher/clang2xml</a>) to help me generate a encode(const MyClass&) decode(MyClass&) that calls the appropriate encode and decode functions, depending on what I scanned. In my case, I also added wrappers for each public function (which actually was my main goal, clang2xml is not as advanced as what I did in the past <a href="http://matt.eifelle.com/2009/07/21/using-gccxml-to-automate-c-wrappers-creation/" target="_blank">http://matt.eifelle.com/2009/07/21/using-gccxml-to-automate-c-wrappers-creation/</a> ), but you can keep it simpler and only serialize and unserialize your data.</div>

<div>With both libclang and the steps I used with gccxml, I think you will be able to achieve your goal ;)</div><div><br></div><div>Cheers,</div><div><br></div><div>Matthieu</div><div><br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/29 Raghavendra Keshav <span dir="ltr"><<a href="mailto:ragavendrakk@gmail.com" target="_blank">ragavendrakk@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">
<div dir="ltr">Hi,<div><br></div><div>Problem: Want to parse C++ classes in a header file and generate</div><div>              serialize and deserialize methods for this class.</div><div>              example:</div>
<div>              sample.h</div><div>               #include ....</div><div>                class Test</div><div>                {</div><div>                    std::map<int,string> myMap;</div>
<div>                    int i;</div><div>                    string s;</div><div>                    A obj;</div><div>                };</div><div><br></div><div>==>Transform it as below</div>
<div><div>                class Test</div><div>                {</div><div>                    std::map<int,string> myMap;</div><div>                    int i;</div><div>                    string s;</div><div>
                    A obj;</div><div>                   public:</div><div>                    void* encode();</div><div>                };</div><div><br></div><div>            void*     Test::encode()</div>
<div>            {</div><div>                for( i- 0; i<myMap.size(); i++)</div><div>                encodeString();</div><div><br></div><div>                 encodeInt();</div><div>
<br></div><div>                 encodeString();</div><div>                 obj.encode();</div><div><br></div><div>               return buf;</div><div>            }</div><div>            </div>
<div>With the tutotials around i could setup the compiler instance<br></div></div><div>and ASTConsumer and ASTVisitor/</div><div>In the ASTRecursive visitor... i could overload visitRecordDecl(...);</div><div>
On getting a CXXRecordDecl...i have iterated through FieldDecl</div><div>Now From FieldDecl...i want to extract information like</div><div>it is map made from int and string...</div><div>Am not able get the relationship of FieldDecl to CTemplateDecl...</div>


<div>and from CTemplateDecl how to extract the params?</div><div><br></div><div>Pls provide direction how to proceed further...</div><div><br></div><div>regards</div><div>ragha</div></div>
<br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Information System Engineer, Ph.D.<br>Blog: <a href="http://matt.eifelle.com" target="_blank">http://matt.eifelle.com</a><span style="padding-right:16px;width:16px;min-height:16px"></span><span style="padding-right:16px;width:16px;min-height:16px"></span><br>

LinkedIn: <a href="http://www.linkedin.com/in/matthieubrucher" target="_blank">http://www.linkedin.com/in/matthieubrucher</a><span style="padding-right:16px;width:16px;min-height:16px"></span><br>Music band: <a href="http://liliejay.com/" target="_blank">http://liliejay.com/</a><span style="padding-right:16px;width:16px;min-height:16px"></span><br>

<span style="padding-right:16px;width:16px;min-height:16px"></span>
</font></span></div>
</blockquote></div><br></div>