I thought there was a boost library that allowed me to parse unix conf files?
I believe it also had other features, i.e. it could parse windows ini files and I think XML based config files might have been done or was on the way too.
Any idea what that's called? I'm looking through the program options library and it doesn't look like the library documentation that I was looking to use just a couple of weeks ago.
EDIT: Ok, I think it's might have been the program options library, but I think I might have been looking at other documentation examples... maybe the tutorials.
Can someone point me in the direction of a complete tutorial to read a conf file?
EDIT: Found it. The Boost Property Tree library that I was looking for!
Boost allows you to parse several configuration file formats; this facility is part of Boost.ProgramOptions.
All the answers on this page are good.
The specific library in boost I was after is called the Property Tree. However, I will point out that his is a relatively new feature and only available since the last one or two revisions. My default boost installation in Kubuntu 10.04.1 doesn't have it, so I had to download the boost library and build it myself.
You're maybe looking for Spirit
Related
I am trying to use Zorba XQuery parser with C++ for my project. I have downloaded and installed Zorba, but I can't seem to find a way to use it in my C++ programs. The documentation doesn't say a word. So if anyone here is good with it, can you please provide me your two cents?
Thank you
You can find examples at their Website
The general way to use an external library is to include its headers into your sourcefiles and add include its library in your link-step.
I'm new to the Fix protocol and I've been trying to find a way to implement it into c++ files starting from a XML description file. So by searching on the net they recommended me with Quickfix, what I really want to know is what do we should call QuickFix? A library or a standard or what exactly?
But my main problem is that lately I downloaded the Quickfix package then I couldn't integrate it into my c++ project even with the QuickFix documentation ( which was vague by the way !) so can someone please describe to me exactly step by step how to configure QuickFix with My Visual c++ project and how can I eventually write this code to parse my XML file:
#include "Application.h"
#include "quickfix/Session.h"
Quickfix doesn't understand XML or parses XML, except for the message bank config file which is in XML. It only deals in FIX formatted strings. You have to use a XML parser i.e. xerces, libxml++ to extract your data in the XML file and then construct a FIX message using the Quickfix library and send wherever you want to.
Fiximate is a more user friendly place to check your FIX messages for correctness. There are examples in the Quickfix library to test an application, and you would need a config file to run it, examples are provided on the Quickfix website.
FIX is a standard: fixprotocol.org/specifications
QuickFIX is a FIX engine (c.f. Library) implementing the standard.
In the source files that you downloaded there is a set of examples which you can use to understand the operation of the engine. You should use these along side the documentation.
QuickFix is a library. There are other FIX engines also available.
It simplifies the implementation by taking care of many low-level things. All a developer has to do is enhance the APIs for messages.
There are good examples for a quick start and good documentation for a beginner.
To get into more details of QuickFix, code itself is well organized.
In stackoverflow.com I have found a question where a user was suggesting to use this libraries of KDE in order to export-inport RTF files. But, when I downloaded I saw that there are lot of files that are included in the .cc and .h files that are missing. So please give a hint how to download all necessary files and is there any guide that gives and example how to use the RTF exporting example(or instructions)?
BTW if you have ever done RTF exporting programmatically in a better way, please tell me how I can do that.
First off, as you mention, that code is part of the KDE project. Its code base is very large, so in the worst case you'd have to provide most of kdebase-dev. The following link contains a tutorial for building KWord from SVN, which will pull in all the dependencies you need (then you can start deleting them as you find they aren't relevant):
http://wiki.koffice.org/index.php?title=Build_KOffice
Browsing the sources, I note a few things.
The #includes pretty much just reference QObjects, so be sure that Qt is installed.
The RTF classes you're looking for seem to subclass KDE objects. This means you may have to go through significant work to separate the base code from KDE if you can't have KDE as a dependency for your project.
edit: Looks like you could probably pull much of the algorithm from ExportFilter.cc, for example, and modify it to your needs. Looks like much of the work is being done via QString rather than KDE methonds.
I'm working on a project using C++, Boost, and Qt. I understand how to compress single files and bytestreams using, for example, the qCompress() function in Qt.
How do I zip a directory of multiple files, including subdirectories? I am looking for a cross-platform (Mac, Win, Linux) solution; I'd prefer not to fire off a bunch of new processes.
Is there a standard way to combine bytestreams from multiple files into a zipped archive, or maybe there is a convenience function or method that would be available in the Boost iostream library?
Many thanks for the assistance.
Update: The QuaZip library looks really great. There is an example in the download package (in the "tests" dir) that shows very clearly how to zip up a directory of files.
Update 2: After completing this task on my Linux build environment, I discovered that QuaZip doesn't work at all with the Visual Studio compiler. It may be possible to tackle all those compiler errors, but a word of caution to anyone looking down this path.
I have found the following two libraries:
ZipIOS++. Seems to be "pure" C++. They don't list Windows explicitly as a supported platform. So i think you should try your luck yourself.
QuaZIP. Based on Qt4. Actually looks nice. They list Windows explicitly (Using mingw). Apparently, it is a C++ wrapper for [this] library.
Ah, and of course, i have ripped those sites from this Qt Mailinglist question about Zipping/Unzipping of directories :)
Just for the record...
Today, I needed to do something very similar in Visual C++. (Though wanted to maintain the possibility to compile the project on other platforms; however preferred not to adopt Qt just for this purpose.)
Ended up using the Minizip library. It is written in plain C, but devising a simple C++ wrapper around it was a breeze, and the end result works great, at least for my purposes.
I have built a wrapper around minizip adding some features that I needed and making it nicer to use it. Is does use the latest c++11 and is developed using Visual Studio 2013, so it should work out-of-the-box for you.
There's a full description here: https://github.com/sebastiandev/zipper
you can zip entire folders, streams, vectors, etc. Also a nice feature is doing everything entirely in memory.
Poco::Zip is also a choice, it has clearly documentation and some code for demo.
Poco::Zip Document
system("zip myarchive.zip *");
I tried QuaZIP 0.4.3 on Windows with VisualStudio 2010 -- there are still issues but can be resolved easily.
To build with VS:
Use CMake to configure and generate VS solution for QuaZIP.
Open soltion with VS and build -- you'll first notice that it can't find 'zlib.h'.
Open preferences for quazip project and add path to Qt's copy of Zlib to C/C++->General->Additional Include Directories: $(QTDIR)/src/3rdparty/zlib.
Rebuild again and you'll get lots of warnings and one error C2491: dllimport static issue on QuaZipFile::staticMetaObject.
This is because QuaZipFile is declared like "class QUAZIP_EXPORT QuaZipFile" and QUAZIP_EXPORT needs to resolve to Q_DECL_EXPORT for dll and to Q_DECL_IMPORT for application, based on whether QUAZIP_BUILD is defined or not. When building QuaZIP QUAZIP_BUILD should be defined but isn't -- configuration process defines in error completely useless "quazip_EXPORTS" instead.
To fix, just remove "quazip_EXPORTS" from all build configurations and add QUAZIP_BUILD instead -- QuaZIP will now build fine.
YAML seems like a great format for configuration files & data binding persistent objects in human-readable form...
Is there a C++ library that handles YAML? Does Boost::Serialization have plans for a YAML option?
EDIT: I would prefer an OO library.
A quick search gave me this: yaml-cpp
Try the YAML component from the BOOST vault serialization library.
EDIT 2014: A recent development, https://groups.google.com/d/msg/boost-devel-archive/mhT7qIh1nsI/uXAuXFAWrxQJ
EDIT 2019: Didn't try it yet, but this seems to be a serious take: https://github.com/rwols/yaml-archive
I found this, please if you use it let me know how it did it for you and post some example if possible,
https://code.google.com/p/google-summer-of-code-2008-boost/downloads/list
UPDATED link (as 2014), it seems to point to the same files as the BOOST vault answer.