Ellié Computing Home Page
My Shopping Cart

Your shopping cart is empty

Display Cart

Call us at +1 586 62 ELLIE / +1 586 62 35543 Office Opened
sales@elliecomputing.com - Contact us


UserFileType object

 

 

Prototype for UserFileType objects

Syntax

function UserFileType (document_type)
returns UserFileType

To create a file type:
var uft = new UserFileTypes ("texts");

Parameters

document_type.  Document Type string. 

Property Of

file_types Array in OptionsSet object.
 

Implemented In

ECMerge 2.2

Description

A UserFileType object represent a file type as defined in the user interface. A document type is associated to it during construction and cannot change anymore. This document type is used to specify how to edit and compare files of that type.

If the document type has properties which can be defined per file type, the 'options' member contains them.

Properties

Property Description
active Boolean. True is this file type is tested and may be used. False if the file type is just kept for memory 
document_type Document Type string. Read-only. Type of document to use to view/edit and compare that kind of files
label Name to display in the File types panels
options ConfigurationObject object. Stores options specific to the document type
patterns String. Patterns checked to activate the file type. See Writing patterns for filenames.


Text specific properties

Found inside UserFileType 'options' member

Property Description
edition.default_encoding Encoding string. If empty, platform default encoding is used. Encoding used when loading files if nothing else could indicate the encoding of a file
edition.default_saving_encoding EncodingProperties object. Indicates how to save text files by default.
edition.tab_inserts_spaces Boolean. True if pressing TAB will insert the right number of spaces to reach next tabulation column.
edition.tabs_into_spaces Integer. Space between two tabulations columns.
edition.wrap_lines Boolean. True if long lines should be wrapped. 
filters.loading Filters List. List of filters which may be applied when loading. Currently only XML built-in filters can be used here.
filters.saving Filters List. List of filters which may be applied when saving. Currently only XML built-in filters can be used here.
ignorable.lines_covered_by_multiline_pattern String. Lines covered by that pattern can be ignored
ignorable.lines_matching String. Lines matching that pattern can be ignored


Binary specific properties

Found inside UserFileType 'options' member

Property Description
dynamic_fields_script String. If not empty, the script is executed each time the file is reloaded. The script must be the body of a function taking two parameters content and dynamic_fields.  The function must study the content object and fills dynamic_fields accordingly.
fields Array of BinaryDocument.Field objects. These fields can be ignored when comparing binary files.
signature.end Integer. Offset in bytes before which the signature must be found
signature.mask Hexadecimal String. If not empty, the signature will be compared to the array of bytes starting at searched position combined with a binary AND operation with this array of bytes coded as hexdecimal digits (e.g. FF00FF makes second byte unimportant is the signature)
signature.signature Hexadecimal String. If not empty, the file type is recognized only if the signature is found bewteen signature.start and signature.end positions.
signature.start Integer. Offset in bytes from which the signature is searched

 

Methods

 none.

Examples

Example 1.

Creates a text file type and adds it to the file types used by a document:
var ft = new UserFileType ("texts");
ft.label = "C++ files";
ft.patterns  = "*.cpp";
var params = mydoc.parameters.clone( );
param.settings.file_types.push (ft);
mydoc.parameters  = param;

See Also 

  Document Type string, Writing patterns for filenames, ConfigurationObject object, BinaryDocument.Field object