dca::Categories Class Reference
[DCA Base Package]

#include <base_categories.h>

List of all members.


Detailed Description

Definition of a container class for Category objects.

See also:
CategoriesInfo, Category
void EnumerateCategoriesInfo( const dca::DcaInstance& myDca )
{
        // assume we have a successfully initialized DcaInstance myDca

        // get internal DCA categories info related to URL signature database...
        const dca::CategoriesInfo myCategoriesInfo = myDca.getCategoriesInfo( DCA_CAT_INFO_TYPE_URL );

        // enumerate categories...
        {
                const dca::Categories myCategories = myCategoriesInfo.getCategories();
                const DCA_SIZE_TYPE numOfCategories = myCategories.size();
                for( DCA_INDEX_TYPE i = 0; i < numOfCategories; ++i ) {
                        dca::Category myCategory = myCategories[ i ];
                        cout << (i+1)
                             << ") Category name=" << myCategory.name( "" )
                                 <<      ", id=" << myCategory.id()
                                 <<      ", groupId=" << myCategory.groupId() << endl;
                }
        }

        // enumerate groups...
        {
                const dca::Groups myGroups = myCategoriesInfo.getGroups();
                const DCA_SIZE_TYPE numOfGroups = myGroups.size();
                for( DCA_INDEX_TYPE i = 0; i < numOfGroups; ++i ) {
                        dca::Group myGroup = myGroups[ i ];
                        cout << (i+1)
                                 << ") Group name=" << myGroup.name( "" )
                                 << ", id=" << myGroup.id() << endl;
                }
        }

        // enumerate locales...
        {
                const dca::Locales myLocales = myCategoriesInfo.getLocales();
                const DCA_SIZE_TYPE numOfLocales = myLocales.size();
                for( DCA_INDEX_TYPE i = 0; i < numOfLocales; ++i ) {
                        dca::Locale myLocale = myLocales[ i ];
                        cout << (i+1)
                                 << ") Locale displayName='" << myLocale.displayName()
                                 << "', languageId='" << myLocale.languageId() << "'"
                                 << endl;
                }
        }
}

Definition at line 33 of file base_categories.h.

Public Member Functions

Category at (DCA_INDEX_TYPE index) const
 Returns the Category with given index.
Category operator[] (DCA_INDEX_TYPE index) const
 Similar to at() but allows a more C++ style access.
DCA_SIZE_TYPE size () const
 Returns the number of categories in the container.
Category byId (DCA_CATEGORY_ID_TYPE id) const
 Returns the category with the given category id.

Member Function Documentation

Category dca::Categories::at ( DCA_INDEX_TYPE  index  )  const

Returns the Category with given index.

Parameters:
[in] index The index of the category. Range is from 0 to size() - 1
Returns:
The Category with the given index in the container.
Note:
Throws an exception of type dca::ExDca if given index is out of range.
Category dca::Categories::operator[] ( DCA_INDEX_TYPE  index  )  const

Similar to at() but allows a more C++ style access.

Parameters:
[in] index The index of the category. Range is from 0 to size() - 1
Returns:
The Category with the given index in the container.
Note:
Throws an exception of type dca::ExDca if given index is out of range.
DCA_SIZE_TYPE dca::Categories::size (  )  const

Returns the number of categories in the container.

Returns:
The size of the container or 0 if the container is empty.
Category dca::Categories::byId ( DCA_CATEGORY_ID_TYPE  id  )  const

Returns the category with the given category id.

Parameters:
[in] id The id of the requested category
Returns:
The Category with the given id in the container.

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

Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1