На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

Embedded Objects



When reconciling a document, the briefcase reconciler itself may become an initiator if it discovers an embedded object of a type that it cannot reconcile. In this case, the reconciler needs to recursively reconcile each of the embedded objects and assume all the responsibilities of an initiator.

To carry out the recursion, the briefcase reconciler loads the object and queries for the appropriate interface. The handler for the object must support the interface. If any member function of the interface returns the OLE_E_NOTRUNNING value, the reconciler must run the object in order to carry out the operation. Because code for embedded objects is not always available, a reconciler must provide a solution for this condition. For example, the reconciler might include both old and new versions of the embedded object in the reconciled version. The reconciler must not attempt to reconcile across links.

The initiator stores the document versions being merged. In many cases, the initiator has access to the storage of each version and saves the result of reconciliation using similar storage. Sometimes, however, the initiator may have an in-memory object for which no persistent version is available. This situation can occur when a document containing open embedded objects must be reconciled before being saved. In such cases, the initiator saves the result of the reconciliation in the version found in memory.

The initiator uses the IPersistStorage interface to bind (load) the merged version. The initiator uses the IPersistStorage::Load member function if an initial version has already been created and uses the IPersistStorage::InitNew member function for the initial version. Once the merged version is loaded, the initiator uses QueryInterface to retrieve the address of the IReconcilableObject interface. This interface gives the initiator access to the storage of the existing residues and gives it a way to create storage for any new residues. Then the initiator directs the interface to carry out the reconciliation. The initiator actually queries for the IPersistFile interface before IPersistStorage. If the reconciler supports IPersistFile, the initiator manipulates the replica through the IPersistFile rather than IPersistStorage member functions. This permits reconciliation of files that are not stored as compound documents.

Once the reconciliation is complete, the initiator can save the merged version by using the IPersistStorage or IPersistFile interface. During reconciliation, the briefcase reconciler creates residues as needed and writes their persistent bits to storage. If the merged version is a stream, the IStorage interface passed to IPersistStorage::Load contains a stream named "Contents" with its storage state set to STATEBITS_FLAT. (You can set the state bits by using the IStorage::Stat member function.) After the merge, the initiator saves the merged version by writing the data in an appropriate manner. It should ensure that STATEBITS_FLAT is set as appropriate for the storage.


Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

Вложенные Объекты



Выверяя документ, сам портфель reconciler может стать инициатором если он обнаруживает вложенный объект типа, что это не может выверить. В этом случае, reconciler нужно рекурсивно выверять каждые вложенные объекты и принимать все обязанности инициатора.

Для того, чтобы выполнять рекурсию, портфель reconciler загружает объект и запросы для подходящего интерфейса. Вручитель для объекта должен поддержать интерфейс. Если любая функция члена интерфейса возвращает величину OLE_E_NOTRUNNING, reconciler должно запустить объект для того, чтобы выполнять действие. Поскольку код для вложенных объектов не всегда доступен, reconciler должно обеспечить решение для этого условия. Например, reconciler могло включить как старые так и новые версии вложенного объекта в выверенную версию. reconciler не должно пытаться выверяться через связи.

Инициатор хранит версии документа, объединянные. Во многих случаях, инициатор имеет доступ к хранению каждой версии и сохраняет результат примирения используя аналогичное хранение. Иногда, тем не менее, инициатор может иметь in-объект памяти для которого никакая устойчивая версия не доступна. Эта ситуация может произойти когда документ, содержащий открытым вставившее объекты должно быть выверено прежде, чем сохраненное. В таких случаях, инициатор сохраняет результат примирения в версии обнаруженной в памяти.

Инициатор использует интерфейс IPersistStorage, чтобы связывать (нагрузка) объединенная версия. Инициатор использует IPersistStorage::функция члена Нагрузки если начальная версия уже создана и использована IPersistStorage::функция члена InitNew для начальной версии. Как только объединенная версия будет загружена, инициатор использует QueryInterface, чтобы извлекать адрес интерфейса IReconcilableObject. Этот интерфейс дает доступ инициатора к хранению существующих остатков и дает это путь создавать хранение для любых новых остатков. Затем инициатор направляет интерфейс, чтобы выполнять примирение. Действительно запросы инициатора для IPersistFile связываются перед IPersistStorage. Если reconciler поддерживает IPersistFile, инициатор манипулирует копией через IPersistFile а не функции члена IPersistStorage. Это разрешает примирение файлов, что не сохранены как сложные документы.

Как только примирение будет завершенно, инициатор может сохранить объединенную версию используя IPersistStorage или интерфейс IPersistFile. В течение примирения, портфель reconciler создает остатки как и требуется и пишет их устойчивые биты на хранение. Если объединенная версия является потоком, интерфейс IStorage проходил на IPersistStorage::Нагрузка содержит поток назвавший "Содержание" со своим состоянием хранения установленным на STATEBITS_FLAT. (Вы можете установить государственные биты используя IStorage::функция члена Stat.) После слияния, инициатор сохраняет объединенную версию пиша данные в подходящем способе. Это должно проверить, что STATEBITS_FLAT установлен как подходящий для памяти.


Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz