ContentGetSupportedField: Difference between revisions

From TotalcmdWiki
Jump to navigation Jump to search
No edit summary
(Added backlink and category)
 
Line 69: Line 69:


Note about ft_comparecontent (New with TC 7.51, plugin interface version >=2.10): If [[ContentCompareFiles]] is exported by the plugin, Total Commander calls ContentGetSupportedField starting with index 10000 from "Synchronize dirs". "FieldName" must be filled with the name of the compare function, e.g. "Compare as text (ignore line breaks)", and the return value must be ft_comparecontent. The Units field is ignored. When comparing two files, Total Commander calls [[ContentCompareFiles]] with the FieldIndex value from this function (10000 for the first compare function, 10001 for the second etc).
Note about ft_comparecontent (New with TC 7.51, plugin interface version >=2.10): If [[ContentCompareFiles]] is exported by the plugin, Total Commander calls ContentGetSupportedField starting with index 10000 from "Synchronize dirs". "FieldName" must be filled with the name of the compare function, e.g. "Compare as text (ignore line breaks)", and the return value must be ft_comparecontent. The Units field is ignored. When comparing two files, Total Commander calls [[ContentCompareFiles]] with the FieldIndex value from this function (10000 for the first compare function, 10001 for the second etc).
{{backlink|Content plugins developer guide|Content plugins developer guide}}
[[category:Content plugin API]]

Latest revision as of 10:01, 22 April 2017

ContentGetSupportedField is called to enumerate all supported fields. FieldIndex is increased by 1 starting from 0 until the plugin returns ft_nomorefields.

Declaration:

int __stdcall ContentGetSupportedField(int FieldIndex,char* FieldName, char* Units,int maxlen);

Description of parameters:

FieldIndex The index of the field for which TC requests information. Starting with 0, the FieldIndex is increased until the plugin returns an error.
FieldName (vertical line) : (colon). You may return a maximum of maxlen characters, including the trailing 0.
Units kbytes|Mbytes . The separator is the vertical dash (Alt+0124). As field names, unit names may not contain a vertical dash, a dot, or a colon. You may return a maximum of maxlen characters, including the trailing 0.

If the field type is ft_multiplechoice, the plugin needs to return all possible values here. Example: The field "File Type" of the built-in content plugin can have the values "File", "Folder" and "Reparse point". The available choices need to be returned in the following form: File|Folder|Reparse point . The same separator is used as for Units. You may return a maximum of maxlen characters, including the trailing 0. The field type ft_multiplechoice does NOT support any units.

maxlen The maximum number of characters, including the trailing 0, which may be returned in each of the fields.

Return value:

The function needs to return one of the following values:

ft_nomorefields The FieldIndex is beyond the last available field.
ft_numeric_32 A 32-bit signed number
ft_numeric_64 A 64-bit signed number, e.g. for file sizes
A double precision floating point number
ft_date A date value (year, month, day)
ft_time A time value (hour, minute, second). Date and time are in local time.
ft_boolean A true/false value
ft_multiplechoice A value allowing a limited number of choices. Use the Units field to return all possible values.
ft_string A text string. Values returned by ContentGetValue may be of type ft_stringw or ft_string.
ft_fulltext A full text (multiple text strings), only used for searching. Can be used e.g. for searching in the text portion of binary files, where the plugin makes the necessary translations. All fields of this type MUST be placed at the END of the field list, otherwise you will get errors in Total Commander!
ft_datetime A timestamp of type FILETIME, as returned e.g. by FindFirstFile(). It is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601. The time MUST be relative to universal time (Greenwich mean time) as returned by the file system, not local time!
ft_comparecontent: This type can be returned only for FieldIndex >= 10'000! It is used in "Synchronize dirs" only (see notes below). Requires plugin version>=2.10.

Remarks:

Please note that fields of type ft_fulltext only show up in the search function, not in the multi-rename tool or the file lists. All fields of this type MUST be placed at the END of the field list, otherwise you will get errors in Total Commander! This is necessary because these fields will be removed from field lists e.g. in the "configure custom column view" dialog. You should use the ft_string type for shorter one line texts suitable for displaying in file lists and for renaming.

Note about ft_comparecontent (New with TC 7.51, plugin interface version >=2.10): If ContentCompareFiles is exported by the plugin, Total Commander calls ContentGetSupportedField starting with index 10000 from "Synchronize dirs". "FieldName" must be filled with the name of the compare function, e.g. "Compare as text (ignore line breaks)", and the return value must be ft_comparecontent. The Units field is ignored. When comparing two files, Total Commander calls ContentCompareFiles with the FieldIndex value from this function (10000 for the first compare function, 10001 for the second etc).


Back to Content plugins developer guide