I'm writing a c++ code using qt and need an editable config file for my user to change some settings. In order to provide him some additional information I would like to add comments to my config file, however I cant find a way to mark them as comments.
I am using QSettings, my file is a .flt file. The usual '#' unfortunately does not seem to work with QSettings.
when using setting files in Qt and the QSettings class, you don't use the "usual"
#
for defining a comment, but the
;
instead...
so:
[abc]
key=val
;this is a comment in the QSettings
flag=true
QSetting's INI file format uses MS Windows file format, which is
a) hierarchical and uses brackets [] for section names
b) uses ; to designate comment lines.
Note, thr default engine of QSetting would wipe any comments, because the whole mechanism is just serialization of name-value pairs from file and to file. To avoid that, a custom reader-writer class should be devised which would read and preserve comments somehow. QSettings supports custom formats by offering interface for read and write functions.
Related
When reading OSM files using GDAL, the fields that are read are defined in osmconf.ini, and if I want that certain tags don't appear within the other_tags then I need to add them to the attributes value in the corresponding sections.
This works fine, but is not really portable, so my questions is, is there a ways to define the settings saved in osmconf.ini in a portable way per project?
This is possible using the CPLSetConfigOption function, and store the config file in current working directory:
CPLSetConfigOption("OSM_CONFIG_FILE", "osmconf.ini");
I am interested in creating a config.cfc which I want to use in differenct components.
in PHP one can create a config.php file which simply return an array. and in other php files this can be included like
use config.php
Can I simple include a .cfm file in any .cfc component? of a config.cfc which simply returns a STRUCT?
I'm not sure how to answer your question because I don't fully understand what you're trying to accomplish. In one sentence you need to return an array and in another sentence you need to return a struct. If you're looking to create a config.cfc your method(s) can return either datatype (array or struct).
To answer your other question, yes you can include a .cfm file within a .cfc. I've done it in the past, although it's not best practice.
What I would suggest instead, in your config.cfc, create any needed methods then use CreateObject() in your calling .cfm or .cfc for usage.
I have seen several projects that use a .cfm file as a config file and it sets a Coldfusion struct variable with setting values. Using cfinclude will then load the file and set a config variable (usually a struct). It could just as easily set an array although I think structs would be more flexible. There is usually logic in the code to cfinclude the config.cfm file once and store the setting in the application scope.
Another option is to use a .json file that contains the same kind of thing but in JSON format. Here's an example of an open source project that does that:
https://github.com/tonyjunkes/CFFormProtect-Revamp/blob/master/cfformprotect/config.json
The controlling code reads the file and uses deserializeJSON() to convert it to a ColdFusion struct. Since it is open source you could download this project and see exactly how it is working.
Yes, you can cfinclude a .cfm from a .cfc file.
I have a large C++ software application documented with doxygen. How can I set it up so that I can generate subdocuments for specific classes? The classes are documented with in-source commenting, their own .dox files, and images/ directory. I need to be able to generate a standalone pdf file specific to a single class.
I can use grouping to identify what will be included in that subdocument, but how do I generate output for a single group?
If you have a specific .dox file per requested output entity, then all you need to do is define in that file as input the files declaring and defining that class.
Say for example you want an output only for class MyClass which is declared in file myclass.hpp and whose implementation is in myclass.cpp, then in myclass.dox, just add this:
INPUT = ./myclass.cpp \
./myclass.hpp
Of course, you can have different paths for .cpp and .hpp. Or you can document more than one class.
Then, run doxygen on that myclass.dox file.
Also watch out for the output folder name. For the html output, the default name is html so you might want to rename it to avoid mixing up all the different outputs. For example, you might want to add in the dox file something like:
HTML_OUTPUT = html_myclass
For MS Office files, like a docx file, image files etc you can set searchable tags from properties in Windows Explorer, see image.
If I have my own custom file format, how can I add that to the details page of my file?
I've been looking at shell extensions, but that doesn't seem to be the way to go. My custom file format is a compound file, so basically a zip archive.
And if it is a shell extension that I should use to enable that for my own custom file, then please which one is it? I've been looking at "The Complete Idiot's Guide to Writing Shell Extensions" but I didn't find anything there, only how to add a new property page.
I'm using MFC.
Thanks!
For Vista and later:
1) Create shell extension implements IPropertyStore, IPropertyStoreCapabilities and IInitializeWithStream. if your cannot work with stream implement IInitializeWithFile instead of IInitializeWithStream. A lot of details.
2) IPropertyStore.GetCount must return number of properties you need. In case you described it must return 1.
3) IPropertyStore.GetAt must return PKEY of your properties. In case you described it must return PKEY_Keywords.
4) Inside IPropertyStore.GetValue you must read your Tags from your zip file and return them in function result.
5) Inside IPropertyStore.SetValue you must store new value in internal memory storage.
6) Inside IPropertyStore.Commin you must store new value from internal memory storage to your real zip file.
7) IPropertyStoreCapabilities.IsPropertyWritable must return S_OK if you want user to edit your property.
8) Create reg value:
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.myzip]
"FullDetails"="prop:System.PropGroup.Description;System.Keywords;System.PropGroup.FileSystem;System.ItemNameDisplay;System.ItemTypeText;System.ItemFolderPathDisplay;System.Size;System.DateCreated;System.DateModified;System.FileAttributes;*System.OfflineAvailability;*System.OfflineStatus;*System.SharedWith;*System.FileOwner;*System.ComputerName"
You can try to replace HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations.myzip with HKEY_CLASSES_ROOT.myzip. Don`t forget to change .myzip to your extension.
9) Enjoy the result:
For XP:
1) Create shell extension implements IColumnProvider. Part VIII of The Complete Idiot's Guide to Writing Shell Extensions.
2) If you want user to edit your Tags you must create Property Sheet shell extension.
I have a multi file template in resharper and I can use $NAME$ macro to get the name of the original file to use to name the other files in the template. But I also want to use the $NAME$ of the original file in the content of the other file template.
Is this possible? I can't see a macro which seems suitable for the internal variables as onlt the Current File Name seems available.
Anyone know if this is possible or how I might workaround this?
As a workaround, you may create a parameter $FILENAME$ (macro "Current file name without extension") in the first file e.g. in the comments, like:
class Foo
{
//$FILENAME$
}
Then you may call this parameter in other files of the multifile template - this parameter will contain the name of the first file since the first file will be generated before other ones.
Unfortunately, there isn't a macro that will give you this. I've added a feature request that you can vote on and track (and more specific detail as to what your requirements are would be useful) - http://youtrack.jetbrains.com/issue/RSRP-415055
It is possible to write your own macros as part of a plugin, but there isn't a sure-fire way of getting the name of the first document in the created file set. The IHotspotSessionContext instance that is passed to the macro via IHotspotSession.Context property includes an enumerable of IDocument, from which you can get IDocument.Moniker, which will be the full path for file based documents. However, there's no guarantee of the order of the enumerable - it's backed by a hashset. You might be able to rely on implementation details (small set, no removes) to be able to use the first document as the original, but there is really no guarantee of this.