libfossil
fsl::Deck Class Reference

The C++ counterpart to the C-side fsl_deck class. More...

#include "fossil.hpp"

Data Structures

class  FCardIterator
 An STL-style iterator class for use with traversing the F-cards in a Deck object. More...
 
class  TCardIterator
 An iterator type for traversing lists of T-cards (tags) in a deck. More...
 

Public Member Functions

 Deck (Context &cx, fsl_catype_t type=FSL_CATYPE_ANY)
 Initializes the deck using the given context. More...
 
 Deck (Context &cx, fsl_deck *d, bool ownsHandle)
 Makes this object a wrapper for d. More...
 
 ~Deck () throw ()
 If this instance owns its underlying handle then this cleans up all resources owned by this instance, otherwise it does nothing. More...
 
DeckaddCardF (char const *name, fsl_uuid_cstr uuid, fsl_file_perm_t perm=FSL_FILE_PERM_REGULAR, char const *oldName=NULL)
 Analog to fsl_deck_F_add() but throws on error and returns this object on success. More...
 
DeckaddCardJ (char isAppend, char const *key, char const *value)
 Analog to fsl_deck_J_add() but throws on error and returns this object on success. More...
 
DeckaddCardM (fsl_uuid_cstr uuid)
 Analog to fsl_deck_M_add() but throws on error and returns this object on success. More...
 
DeckaddCardP (fsl_uuid_cstr uuid)
 Analog to fsl_deck_P_add() but throws on error and returns this object on success. More...
 
DeckaddCardQ (char type, fsl_uuid_cstr target, fsl_uuid_cstr baseline)
 Analog to fsl_deck_Q_add() but throws on error and returns this object on success. More...
 
DeckaddCardT (fsl_tag_type tagType, char const *name, fsl_uuid_cstr uuid=NULL, char const *value=NULL)
 Analog to fsl_deck_T_add() but throws on error and returns this object on success. More...
 
Deck const & assertHasRequiredCards () const
 Analog to fsl_deck_required_cards_check(), but throws if that fails. More...
 
Deckbaseline ()
 If this is a CHECKIN deck and it is a delta manifest then its baseline is lazily loaded (if needed) and returned. More...
 
bool cardIsLegal (char cardLetter) const throw ()
 Analog to fsl_card_is_legal(), passing this->type() as the first argument to that function. More...
 
Deckcleanup () throw ()
 Equivalent to fsl_deck_clean(*this). More...
 
Contextcontext () throw ()
 This deck's Fossil Context. More...
 
Context const & context () const throw ()
 Const-correct overload. More...
 
fsl_deckhandle () throw ()
 See operator fsl_deck*(). More...
 
fsl_deck const * handle () const throw ()
 Const-correct overload. More...
 
bool hasAllRequiredCards () const throw ()
 Analog to fsl_deck_has_required_cards(). More...
 
Deckload (fsl_id_t rid, fsl_catype_t type=FSL_CATYPE_ANY)
 Analog to fsl_deck_load_sym(), but throws on error. More...
 
Deckload (char const *symbolicName, fsl_catype_t type=FSL_CATYPE_ANY)
 Analog to fsl_deck_load_sym(), but throws on error. More...
 
Deckload (std::string const &symbolicName, fsl_catype_t type=FSL_CATYPE_ANY)
 Equivalent to load(symbolicName.c_str(), type). More...
 
 operator fsl_deck * () throw ()
 Implicit conversion to (fsl_deck *) to simplify integration with the C API. More...
 
 operator fsl_deck const * () const throw ()
 Const-correct overload. More...
 
Deck const & output (std::ostream &os) const
 Analog to fsl_deck_output(), sending its output to the given stream. More...
 
Deck const & output (fsl_output_f f, void *outState) const
 Analog to fsl_deck_output(), but throws on error and returns this object on success. More...
 
fsl_id_t rid () const throw ()
 If this deck was load()ed, returns the blob.rid value, else returns 0. More...
 
Decksave (bool isPrivate=false)
 Analog to fsl_deck_save(), but throws on error and returns this object on success. More...
 
DecksetCardA (char const *name, char const *tgt, fsl_uuid_cstr uuid)
 Analog to fsl_deck_A_set() but throws on error and returns this object on success. More...
 
DecksetCardB (fsl_uuid_cstr uuid)
 Analog to fsl_deck_B_set() but throws on error and returns this object on success. More...
 
DecksetCardC (char const *comment)
 Analog to fsl_deck_C_set() but throws on error and returns this object on success. More...
 
DecksetCardD (double julianDay=-1.0)
 Analog to fsl_deck_D_set(), but uses the current time if (julianDay<0) and throws on error. More...
 
DecksetCardE (fsl_uuid_cstr uuid, double julian=-1.0)
 Analog to fsl_deck_E_set() but throws on error and returns this object on success. More...
 
DecksetCardK (fsl_uuid_cstr uuid)
 Analog to fsl_deck_K_set() but throws on error and returns this object on success. More...
 
DecksetCardL (char const *title)
 Analog to fsl_deck_L_set() but throws on error and returns this object on success. More...
 
DecksetCardN (char const *name)
 Analog to fsl_deck_N_set() but throws on error and returns this object on success. More...
 
DecksetCardU (char const *name=NULL)
 Sets the U-card, analog to fsl_deck_U_set(). More...
 
DecksetCardW (char const *content, fsl_int_t len=-1)
 Analog to fsl_deck_W_set() but throws on error and returns this object on success. More...
 
fsl_catype_t type () const throw ()
 If this deck was load()ed, returns the loaded artifact's type, else returns the type set in the constructor. More...
 
Deckunshuffle (bool calcRCard=true)
 Analog to fsl_deck_unshuffle(), but throws on error and returns this object on success. More...
 
fsl_uuid_cstr uuid () const throw ()
 If this deck was load()ed, returns the UUID string, else returns NULL. More...
 

Detailed Description

The C++ counterpart to the C-side fsl_deck class.

Fossil's core metadata syntax calls the entries of the metadata "cards." A Deck (or fsl_deck) is a "collection of cards" which make up an atomic unit of metadata. In Fossil jargon a deck is called an "artifact," but libfossil adopted the name "deck" because "artifact" already has several meanings in this context.

Definition at line 1522 of file fossil.hpp.

Constructor & Destructor Documentation

fsl::Deck::~Deck ( )
throw (
)

If this instance owns its underlying handle then this cleans up all resources owned by this instance, otherwise it does nothing.

fsl::Deck::Deck ( Context cx,
fsl_catype_t  type = FSL_CATYPE_ANY 
)
explicit

Initializes the deck using the given context.

The second argument is only important when constructing decks, not when loading them.

fsl::Deck::Deck ( Context cx,
fsl_deck d,
bool  ownsHandle 
)

Makes this object a wrapper for d.

If ownsHandle is true then this object takes over ownership of d, otherwise d is assumed to be owned elsewhere and it _must_ outlive this object.

Member Function Documentation

Deck& fsl::Deck::addCardF ( char const *  name,
fsl_uuid_cstr  uuid,
fsl_file_perm_t  perm = FSL_FILE_PERM_REGULAR,
char const *  oldName = NULL 
)

Analog to fsl_deck_F_add() but throws on error and returns this object on success.

Deck& fsl::Deck::addCardJ ( char  isAppend,
char const *  key,
char const *  value 
)

Analog to fsl_deck_J_add() but throws on error and returns this object on success.

Deck& fsl::Deck::addCardM ( fsl_uuid_cstr  uuid)

Analog to fsl_deck_M_add() but throws on error and returns this object on success.

Deck& fsl::Deck::addCardP ( fsl_uuid_cstr  uuid)

Analog to fsl_deck_P_add() but throws on error and returns this object on success.

Deck& fsl::Deck::addCardQ ( char  type,
fsl_uuid_cstr  target,
fsl_uuid_cstr  baseline 
)

Analog to fsl_deck_Q_add() but throws on error and returns this object on success.

Deck& fsl::Deck::addCardT ( fsl_tag_type  tagType,
char const *  name,
fsl_uuid_cstr  uuid = NULL,
char const *  value = NULL 
)

Analog to fsl_deck_T_add() but throws on error and returns this object on success.

Deck const& fsl::Deck::assertHasRequiredCards ( ) const

Analog to fsl_deck_required_cards_check(), but throws if that fails.

Deck* fsl::Deck::baseline ( )

If this is a CHECKIN deck and it is a delta manifest then its baseline is lazily loaded (if needed) and returned.

Throws on loading error. Returns NULL if this is not CHECKIN or not a delta manifest. The returned object is owned by this object and will be cleaned up when it is or when the B-card is re-set (setCardB()).

bool fsl::Deck::cardIsLegal ( char  cardLetter) const
throw (
)

Analog to fsl_card_is_legal(), passing this->type() as the first argument to that function.

Deck& fsl::Deck::cleanup ( )
throw (
)

Equivalent to fsl_deck_clean(*this).

Context& fsl::Deck::context ( )
throw (
)

This deck's Fossil Context.

Context const& fsl::Deck::context ( ) const
throw (
)

Const-correct overload.

fsl_deck* fsl::Deck::handle ( )
throw (
)

See operator fsl_deck*().

fsl_deck const* fsl::Deck::handle ( ) const
throw (
)

Const-correct overload.

bool fsl::Deck::hasAllRequiredCards ( ) const
throw (
)
Deck& fsl::Deck::load ( fsl_id_t  rid,
fsl_catype_t  type = FSL_CATYPE_ANY 
)

Analog to fsl_deck_load_sym(), but throws on error.

Populates this object with the loaded state.

Deck& fsl::Deck::load ( char const *  symbolicName,
fsl_catype_t  type = FSL_CATYPE_ANY 
)

Analog to fsl_deck_load_sym(), but throws on error.

Populates this object with the loaded state.

Deck& fsl::Deck::load ( std::string const &  symbolicName,
fsl_catype_t  type = FSL_CATYPE_ANY 
)

Equivalent to load(symbolicName.c_str(), type).

fsl::Deck::operator fsl_deck * ( )
throw (
)

Implicit conversion to (fsl_deck *) to simplify integration with the C API.

ABSOLUTELY DO NOT use this conversion...

  • ... with fsl_deck_finalize(), as that may (depending on usage) steal a pointer out from under C++.
  • ... expect this conversion to be picked up when a function takes a void pointer argument.
fsl::Deck::operator fsl_deck const * ( ) const
throw (
)

Const-correct overload.

Deck const& fsl::Deck::output ( std::ostream &  os) const

Analog to fsl_deck_output(), sending its output to the given stream.

Throws on error and returns this object on success.

Deck const& fsl::Deck::output ( fsl_output_f  f,
void *  outState 
) const

Analog to fsl_deck_output(), but throws on error and returns this object on success.

fsl_id_t fsl::Deck::rid ( ) const
throw (
)

If this deck was load()ed, returns the blob.rid value, else returns 0.

Deck& fsl::Deck::save ( bool  isPrivate = false)

Analog to fsl_deck_save(), but throws on error and returns this object on success.

Deck& fsl::Deck::setCardA ( char const *  name,
char const *  tgt,
fsl_uuid_cstr  uuid 
)

Analog to fsl_deck_A_set() but throws on error and returns this object on success.

Deck& fsl::Deck::setCardB ( fsl_uuid_cstr  uuid)

Analog to fsl_deck_B_set() but throws on error and returns this object on success.

This destroys any object previously returned by baseline().

Deck& fsl::Deck::setCardC ( char const *  comment)

Analog to fsl_deck_C_set() but throws on error and returns this object on success.

Deck& fsl::Deck::setCardD ( double  julianDay = -1.0)

Analog to fsl_deck_D_set(), but uses the current time if (julianDay<0) and throws on error.

Deck& fsl::Deck::setCardE ( fsl_uuid_cstr  uuid,
double  julian = -1.0 
)

Analog to fsl_deck_E_set() but throws on error and returns this object on success.

If the 2nd argument is less than 0 then the current time is used by default.

Deck& fsl::Deck::setCardK ( fsl_uuid_cstr  uuid)

Analog to fsl_deck_K_set() but throws on error and returns this object on success.

Deck& fsl::Deck::setCardL ( char const *  title)

Analog to fsl_deck_L_set() but throws on error and returns this object on success.

Deck& fsl::Deck::setCardN ( char const *  name)

Analog to fsl_deck_N_set() but throws on error and returns this object on success.

Deck& fsl::Deck::setCardU ( char const *  name = NULL)

Sets the U-card, analog to fsl_deck_U_set().

If name is NULL or !*name then fsl_cx_user_get(this->context()) is used to fetch the name. An empty name is not legal.

Throws on error.

Deck& fsl::Deck::setCardW ( char const *  content,
fsl_int_t  len = -1 
)

Analog to fsl_deck_W_set() but throws on error and returns this object on success.

fsl_catype_t fsl::Deck::type ( ) const
throw (
)

If this deck was load()ed, returns the loaded artifact's type, else returns the type set in the constructor.

Deck& fsl::Deck::unshuffle ( bool  calcRCard = true)

Analog to fsl_deck_unshuffle(), but throws on error and returns this object on success.

Reminder: this is only necessary when using output().

fsl_uuid_cstr fsl::Deck::uuid ( ) const
throw (
)

If this deck was load()ed, returns the UUID string, else returns NULL.

The bytes are owned by this object and may be invalidated by load().


The documentation for this class was generated from the following file: