www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - [XMLSTL] Status update

reply "Matthew" <nowhere noaddress.co.us> writes:
I know this project seems like total vapourware, but there have been some 
relevant movements recently. Specifically:

1. The next STLSoft 1.9.1 beta will include the new comstl components: bstr, 
variant and ole_object. bstr is a thin wrapper for BSTR, variant is a thin 
wrapper for VARIANT. ole_object is scripting driver, that allows you to 
drive an automation server's scripting interface from C++. A sample from one 
of the test drivers is included below. The current version of XMLSTL relied 
on Synesis Software components (BStr and Variant), which brought DLLs into 
the picture. Getting rid of all that makes a distributable form now much 
more straightforward.

2. My next book (after Extended STL; http://extendedstl.com/) is going to be 
about how to make C++ facades and libraries play nice. XMLSTL is going to be 
one of the cases studies. So I plan to strip it back to nothing and do a 
complete rewrite, and documenting it as I go. I plan to release it in an 
incremental fashion during that process, both in order to solicit useful 
feedback, and to trial the principles that'll be espoused in the new book. 
This process should start in September, I hope. (There will also be some 
other case studies carried out, probably including a DbSTL wrapper library 
for SQLite3.) If anyone wants to volunteer for any of these, just post a 
note or drop me a line (via http://imperfectcplusplus.com/) and I'll get in 
touch when the work starts.

Cheers

Matthew


  LPDISPATCH  pdisp;
  HRESULT     hr  = comstl::co_create_instance(L"openrj.com.Database", 
&pdisp);
//  HRESULT   hr  = 
comstl::co_create_instance(L"{75A04F35-6389-4F9C-9BCA-6FAFFC818BA3}", 
&pdisp);

  if(FAILED(hr))
  {
    ::fprintf(stderr, "Failed: %s\n", winstl::error_desc(hr).c_str());
  }
  else
  {
    using comstl::bstr;
    using comstl::ole_object;

    ole_object  database(pdisp, false);

    ole_object  DatabaseFlags = 
ole_object::create(L"openrj.com.DatabaseFlags", 
comstl::coercion_level::nonDestructiveTruncation);

    LPCOLESTR fileName  = 
L"H:\\freelibs\\openrj\\current\\samples\\pets\\pets.orj";

    long      flags     = 
DatabaseFlags.get_property<long>(L"ElideBlankRecords");

    database.invoke_method_v(L"OpenFile", fileName, flags);

    stlsoft::ref_ptr<IUnknown>  _Enum = 
database.get_property(of_type<stlsoft::ref_ptr<IUnknown> >(), 
DISPID_NEWENUM);


    bstr    DocString = database.get_property<bstr>(L"DocString");


    bstr    File    = database.get_property<bstr>(L"File");
    long    NumFields = database.get_property<long>(L"NumFields");
    long    NumRecords  = database.get_property<long>(L"Count");

    { for(long i = 0; i < NumRecords; ++i)
    {
      ole_object  record        = database[i];
      long        Count = record.get_property<long>(L"Count");
      bstr        Comment       = record.get_property<bstr>(L"Comment");

      { for(long j = 0; j < Count; ++j)
      {
        ole_object  field = record[j];
        bstr    Name  = field.get_property<bstr>(L"Name");
        bstr    Value = field.get_property<bstr>(L"Value");
      }}
    }}

    database.invoke_method_v(L"Close");
  }
Aug 12 2006
parent Cesar Rabak <crabak acm.org> writes:
Matthew escreveu:
 I know this project seems like total vapourware, but there have been some 
 relevant movements recently. Specifically:

Mathew, it is 'dryiceware': you see some fumes but in core there is substance!! Keep going with this nice work :-)
Aug 13 2006