Provides access to the design history of a specified file. More...
#include <DesignHistory.h>
Classes | |
struct | TagDefinition |
The definition of a tag. More... | |
Public Member Functions | |
DGNPLATFORM_EXPORT | DesignHistory (DgnFileR) |
Constructor. More... | |
DGNPLATFORM_EXPORT | DesignHistory () |
DgnFileP | GetDgnFileP () const |
Query the DgnFile to which this applies. More... | |
DGNPLATFORM_EXPORT StatusInt | CheckFormatVersion (bool prompt) const |
Utility to check design history file format version. More... | |
Query revisions in design history | |
DGNPLATFORM_EXPORT RevisionNumber | GetTip () const |
Query tip revision number. More... | |
DGNPLATFORM_EXPORT RevisionNumber | GetNextPossibleRevisionNumber (DgnHistory::RevisionNumber const &r) |
Query the next revision number that could possibly follow the specified number in this file. More... | |
DGNPLATFORM_EXPORT RevisionNumber | GetEarliest () const |
Query first revision number. More... | |
DGNPLATFORM_EXPORT StatusInt | GetRevisionNumbers (RevisionNumbersForFile &revNos, RevisionNumber const &startRevNo=RevisionNumber(), RevisionNumber const &endRevNo=RevisionNumber()) const |
Get revision numbers in specified range. More... | |
DGNPLATFORM_EXPORT StatusInt | GetRevisions (T_RevisionInfoVector &revs, RevisionNumbersForFile &nums, ElementChangeRecordFilter const *ssfilter=0, bool removeRejectedRevisions=false) const |
Get information about the specified revisions. More... | |
DGNPLATFORM_EXPORT StatusInt | GetTags (bvector< TagDefinition > &tags) |
Get all tags defined in design history. More... | |
DGNPLATFORM_EXPORT StatusInt | GetTag (DgnHistory::RevisionNumber *revNo, WChar const *tag) |
Get the revision number associated with the specified tag. More... | |
DGNPLATFORM_EXPORT StatusInt | SetTag (WChar const *tag, RevisionNumber const &revNo, bool replaceExisting) |
Associate a tag with the specified revision number. More... | |
DGNPLATFORM_EXPORT StatusInt | RemoveTag (WChar const *tag) |
Remove the specified tag from design history. More... | |
Query element versions in design history | |
DGNPLATFORM_EXPORT RefCountedPtr < ElementsAsOfQuery > | QueryPreChangeState (RevisionNumbersForFile const &range) |
Query the pre-change state of all elements involved in the specified revisions. More... | |
DGNPLATFORM_EXPORT RefCountedPtr < ElementsAsOfQuery > | QueryPostChangeState (RevisionNumbersForFile const &range) |
Query the post-change state of all elements involved in the specified revisions. More... | |
DGNPLATFORM_EXPORT StatusInt | QueryElementAsOf (EditElementHandleR historicalVersion, ModelId modelId, ElementId elementId, RevisionNumber const &rev) |
Query the state of the specified element as of the specified revision. More... | |
Commit changes to design history | |
DGNPLATFORM_EXPORT bool | CheckUncommittedChanges (bool force=false) const |
Check if there are any uncommitted changes. More... | |
DGNPLATFORM_EXPORT StatusInt | Commit (RevisionInfo *result, CommitInfo const &parms, bool ignoreVersion=false) const |
Commit recent changes to design history. More... | |
Static Public Member Functions | |
static DGNPLATFORM_EXPORT StatusInt | ExtractModelElementInfo (ModelInfoR pInfo, MSElementDescrCP modelElement, DgnFileP dgnFile) |
Extract the model info from a model header element. More... | |
static DGNPLATFORM_EXPORT StatusInt | GetLastError (WStringR details) |
Query the value of the most recent history-related error. More... | |
Detect, initialize, and delete design history | |
DGNPLATFORM_EXPORT StatusInt | CombineRevisions (RevisionNumber const &start, RevisionNumber const &end, CommitInfo const &parms) |
Combine a range of revisions into a single revision that captures the net outcome of the original change set. More... | |
DGNPLATFORM_EXPORT StatusInt | DeleteEarlyRevisions (RevisionNumber const &tooOld) |
Remove all revisions from and including tooOld to the beginning of history. More... | |
DGNPLATFORM_EXPORT StatusInt | UpdateRevision (RevisionNumber const &revNo, WChar const *user, WChar const *desc) |
Update the userid and/or description associated with the specified revision. More... | |
static DGNPLATFORM_EXPORT bool | ContainsHistory (DgnFileR) |
Test if the specified file has design history. More... | |
static DGNPLATFORM_EXPORT StatusInt | InitializeHistory (DgnFileR file, WChar const *comment) |
Initialize design history in the specified file. More... | |
static DGNPLATFORM_EXPORT StatusInt | RemoveHistory (DgnFileR) |
Remove design history from the specified file. More... | |
Revision number formatting and parsing | |
DGNPLATFORM_EXPORT WString | GetRevisionNumberFormat () const |
Get the revision number format to apply to revision numbers in this file. More... | |
DGNPLATFORM_EXPORT void | SetRevisionNumberFormat (WChar const *) |
Set the revision number format to apply to revision numbers in this file. More... | |
DGNPLATFORM_EXPORT WString | FormatRevisionNumber (DgnHistory::RevisionNumber const &) |
Format a revision number, using the registered format for this file. More... | |
DGNPLATFORM_EXPORT RevisionNumber | ParseRevisionNumber (WChar const *str, WChar const *fmt=0) const |
Format a revision number, using the specified format. More... | |
static DGNPLATFORM_EXPORT WString | FormatRevisionNumber (DgnHistory::RevisionNumber const &, WChar const *) |
Format a revision number, using the specified format. More... | |
Provides access to the design history of a specified file.
Design history is a mechanism for recording changes to a design file. The main methods are:
Administrative methods:
|
explicit |
Constructor.
DGNPLATFORM_EXPORT StatusInt CheckFormatVersion | ( | bool | prompt | ) | const |
Utility to check design history file format version.
[in] | prompt | set to true if you want to prompt the user to confirm in the case where history was created/modified by an earlier version. If the user declines, HISTORY_ERROR_BACKWARD_COMPATIBILITY is returned. |
DGNPLATFORM_EXPORT bool CheckUncommittedChanges | ( | bool | force = false | ) | const |
Check if there are any uncommitted changes.
force | in optional. If force is true, this method scans the file to check for changes. If it finds none, it also makes sure that the archive flags are clear on all elements. |
DGNPLATFORM_EXPORT StatusInt CombineRevisions | ( | RevisionNumber const & | start, |
RevisionNumber const & | end, | ||
CommitInfo const & | parms | ||
) |
Combine a range of revisions into a single revision that captures the net outcome of the original change set.
If successful, a new revision is created and the original revisions are deleted.
[in] | start | revision number of start of range of revisions to combine (inclusive) |
[in] | end | revision number of end of range of revisions to combine (inclusive) |
[in] | parms | the user and description for the combined revision |
This function requires the MS_DESIGN_HISTORY=delete=1 capability to be enabled.
DGNPLATFORM_EXPORT StatusInt Commit | ( | RevisionInfo * | result, |
CommitInfo const & | parms, | ||
bool | ignoreVersion = false |
||
) | const |
Commit recent changes to design history.
If successful, creates a new revision. Optionally reports the new revision in result.
result | if not NULL, this is set to the results of the commit |
parms | user, description, and optional revision number for commit |
ignoreVersion | skip the tests for forward and backward compatibility |
|
static |
Test if the specified file has design history.
DGNPLATFORM_EXPORT StatusInt DeleteEarlyRevisions | ( | RevisionNumber const & | tooOld | ) |
Remove all revisions from and including tooOld to the beginning of history.
[in] | tooOld | delete all from 1.1 up to and including this revision |
|
static |
Extract the model info from a model header element.
This function is useful when querying historical changes and encountering a model-level change. In that case, the history manager will supply an element representing the model's state as of that time. This function can be used to query the ID and other properties of the model as of that state.
DGNPLATFORM_EXPORT WString FormatRevisionNumber | ( | DgnHistory::RevisionNumber const & | ) |
Format a revision number, using the registered format for this file.
|
static |
Format a revision number, using the specified format.
DGNPLATFORM_EXPORT RevisionNumber GetEarliest | ( | ) | const |
Query first revision number.
|
static |
Query the value of the most recent history-related error.
Also returns a message from the O/S giving details about the error.
[out] | details | A message from the O/S giving details about the error. |
DGNPLATFORM_EXPORT RevisionNumber GetNextPossibleRevisionNumber | ( | DgnHistory::RevisionNumber const & | r | ) |
Query the next revision number that could possibly follow the specified number in this file.
DGNPLATFORM_EXPORT WString GetRevisionNumberFormat | ( | ) | const |
Get the revision number format to apply to revision numbers in this file.
DGNPLATFORM_EXPORT StatusInt GetRevisionNumbers | ( | RevisionNumbersForFile & | revNos, |
RevisionNumber const & | startRevNo = RevisionNumber() , |
||
RevisionNumber const & | endRevNo = RevisionNumber() |
||
) | const |
Get revision numbers in specified range.
[out] | revNos | revision numbers |
startRevNo | starting revision | |
endRevNo | ending revision |
DGNPLATFORM_EXPORT StatusInt GetRevisions | ( | T_RevisionInfoVector & | revs, |
RevisionNumbersForFile & | nums, | ||
ElementChangeRecordFilter const * | ssfilter = 0 , |
||
bool | removeRejectedRevisions = false |
||
) | const |
Get information about the specified revisions.
[out] | revs | revisions found |
[in,out] | nums | revision numbers to look up. This method calls nums.SetFile(this). This method also breaks out revision numbers for shared file queries. |
ssfilter | if not NULL, specifies that this function should return only revisions that pass this filter (applied on the server) | |
removeRejectedRevisions | if not NULL, specifies that, if ssfilter rejects a revision, this function should not include that revision in revs. |
DGNPLATFORM_EXPORT StatusInt GetTag | ( | DgnHistory::RevisionNumber * | revNo, |
WChar const * | tag | ||
) |
Get the revision number associated with the specified tag.
[out] | revNo | if not NULL, this is set to the revision number associated with the tag, if found. |
[in] | tag | The tag to look up. |
DGNPLATFORM_EXPORT StatusInt GetTags | ( | bvector< TagDefinition > & | tags | ) |
Get all tags defined in design history.
[out] | tags | tags found |
DGNPLATFORM_EXPORT RevisionNumber GetTip | ( | ) | const |
Query tip revision number.
|
static |
Initialize design history in the specified file.
file | file in which to initialize history |
comment | if not NULL, the comment to be stored in Audit Trail |
DGNPLATFORM_EXPORT RevisionNumber ParseRevisionNumber | ( | WChar const * | str, |
WChar const * | fmt = 0 |
||
) | const |
Format a revision number, using the specified format.
[in] | str | the string to parse |
[in] | fmt | If not NULL, the format to use. If NULL, the registered the registered format for this file is used. |
DGNPLATFORM_EXPORT StatusInt QueryElementAsOf | ( | EditElementHandleR | historicalVersion, |
ModelId | modelId, | ||
ElementId | elementId, | ||
RevisionNumber const & | rev | ||
) |
Query the state of the specified element as of the specified revision.
historicalVersion | the historical version of the element |
modelId | the model that holds(held) the element |
elementId | the element's id |
rev | the point in history |
DGNPLATFORM_EXPORT RefCountedPtr<ElementsAsOfQuery> QueryPostChangeState | ( | RevisionNumbersForFile const & | range | ) |
Query the post-change state of all elements involved in the specified revisions.
Query the state of these elements as of the most recent revision in the range.
range | the revisions to query |
DGNPLATFORM_EXPORT RefCountedPtr<ElementsAsOfQuery> QueryPreChangeState | ( | RevisionNumbersForFile const & | range | ) |
Query the pre-change state of all elements involved in the specified revisions.
Query the state of these elements as of the earliest revision in the range.
range | the revisions to query |
|
static |
Remove design history from the specified file.
DGNPLATFORM_EXPORT StatusInt RemoveTag | ( | WChar const * | tag | ) |
Remove the specified tag from design history.
[in] | tag | The tag to remove. |
DGNPLATFORM_EXPORT void SetRevisionNumberFormat | ( | WChar const * | ) |
Set the revision number format to apply to revision numbers in this file.
The format specifies how the two fields of the revision number are to be formatted, in the context of other text. The two fields of the revision number are the major revision number and minor revision number. The major number is identified in the format as field number 0, and the minor number is field number 1.
The format is of the form:
formatClause := { [ "[" range "]" ] messageFormatPattern }+ messageFormatPattern := string [ "{" messageFormatElement "}" string ]* range := start [,end] messageFormatElement := argument [ "," elementFormat ] elementFormat := "letter" [ "," letterStyle ] | "number" letterStyle := { "uppercase"|"lowercase"|"AA"|"AB"|{"omit" letter}* }+
If a range is specified, then the formatting instructions that follow apply only to revisions in the specified range. A messageFormatPattern can have multiple ranges and their associated messageFormatElements. The elementFormat is optional. The default is to format the number as a number. When formatting a revision number as a letter, the numerical value selects the corresponding number in the alphabet. That is, 1->A, 2->B, etc. The optional letterStyle specifies if uppercase or lowercase letters are used. Uppercase is the default. The optional letterStyle can also be used to omit specific letters from the alphabet. When the numerical value passes 26, a combination of letters is produced. The letterStyle specifies how letters are combined. If AA is specified, then the letters are repeated. If AB is specified, then the letters accumulate kind of like an odometer. More specifically, the revision number is first converted to a base-0 index and then converted to a base-26 number. If AA is specified, then the lowest base-26 digit is used as a 0-based index to select a letter, and that letter is repeated as many times as the number is a multiple of 26, plus 1. If AB is specified, then the highest base-26 digit is the decremented, and each base-26 digit is used as a 0-based index to select a letter. (If letters are omitted, then the base will not be 26, but however many letters remain in the alphabet.)
Num AA AB --- --- --- 1 A A 2 B B .. 26 Z Z 27 AA AA 28 BB AB .. 52 ZZ AZ 53 AAA BA 54 BBB BB .. 78 ZZZ BZ 79 AAAA CA
Examples:
Revision Number Desired Appearance Format Specifier 1.2 A2 {0,letter}{1} 1.2 A.2 {0,letter}.{1} 1.2 1.B {0}.{1,letter} 1.2 2A {1}{0,letter} 1.2 B2 {1,letter}{0} 1.2 RevA2 Rev{1,letter}{0} 1.2 RevA2*** Rev{1,letter}{0}*** 1.28 1.BB {0}{1,letter,AA} 1.28 1.AB {0}{1,letter,AB}
Range examples:
[2.1] {0}.{1,letter}
means that revisions starting with 2.1 should be formatted as number.letter, while all revisions before that should be formatted in the default manner (i.e., number.number).
[2.1] {0}.{1,letter} [3.3] {0},{1,letter,AB}
means that revisions from 2.1 to 3.3 (inclusive) should be formatted as number.letter in AA style, while revisions after 3.3 should be formatted as number.letter in AB style.
DGNPLATFORM_EXPORT StatusInt SetTag | ( | WChar const * | tag, |
RevisionNumber const & | revNo, | ||
bool | replaceExisting | ||
) |
Associate a tag with the specified revision number.
[in] | tag | The tag to assign. |
[in] | revNo | The revision number to be named. |
[in] | replaceExisting | if true, revNo should replace the value of any existing tag by the same name. If false, SetTag should return HISTORY_ERROR_DUPLICATE_TAG if the tag already exists. |
DGNPLATFORM_EXPORT StatusInt UpdateRevision | ( | RevisionNumber const & | revNo, |
WChar const * | user, | ||
WChar const * | desc | ||
) |
Update the userid and/or description associated with the specified revision.
revNo | The revision to modify |
user | if not NULL, the new userID |
desc | if not NULL, the new description |