Esempio n. 1
0
void MultipleAvroFileWriter::commit() {
  RMF_TRACE("Writing frame " << frame_.index);
  for (unsigned int i = 0; i < categories_.size(); ++i) {
    if (categories_[i].dirty) {
      if (!categories_[i].writer) {
        std::string name = get_category_dynamic_file_path(Category(i));
        try {
          categories_[i].writer.reset(
              new internal_avro::DataFileWriter<RMF_avro_backend::Data>(
                  name.c_str(), internal_avro::compileJsonSchemaFromString(
                                    data_deprecated_avro::data_json)));
        }
        catch (const std::exception& e) {
          RMF_THROW(Message(e.what()) << Component(name), IOException);
        }
      }
      // show(categories_[i].data);
      RMF_INTERNAL_CHECK(categories_[i].data.frame == frame_.index,
                         "Trying to write category that is at wrong frame.");
      categories_[i].writer->write(categories_[i].data);
      categories_[i].writer->flush();
    }
    categories_[i].data = RMF_avro_backend::Data();
    // go to the about to be added frame
    categories_[i].data.frame = frame_.index + 1;
  }
  for (unsigned int i = 0; i < static_categories_.size(); ++i) {
    if (static_categories_dirty_[i]) {
      std::string name = get_category_static_file_path(Category(i));
      try {
        internal_avro::DataFileWriter<RMF_avro_backend::Data> writer(
            name.c_str(), internal_avro::compileJsonSchemaFromString(
                              data_deprecated_avro::data_json));
        writer.write(static_categories_[i]);
        writer.flush();
      }
      catch (const std::exception& e) {
        RMF_THROW(Message(e.what()) << Component(name), IOException);
      }
      // std::cout << "Writing data for " << get_category_name(Category(i)) <<
      // std::endl;
      // show(static_categories_[i]);
      static_categories_dirty_[i] = false;
    }
  }
  RMF_COMMIT(File, file);
  RMF_COMMIT(Nodes, nodes);
  if (frames_dirty_) {
    if (!frame_writer_) {
      frame_writer_.reset(
          new internal_avro::DataFileWriter<RMF_avro_backend::Frame>(
              get_frames_file_path().c_str(),
              internal_avro::compileJsonSchemaFromString(
                  data_deprecated_avro::frame_json)));
    }
    frame_writer_->write(frame_);
    frames_dirty_ = false;
  }
}
CategoriesModel::CategoriesModel(QObject* parent): QAbstractItemModel(parent)
{
    m_categories.append(Category("All Songs", "audio", Category::AllMusic));
    m_categories.append(Category("Artists", "user-identity", Category::Artists));
    m_categories.append(Category("Albums", "tools-media-optical-copy", Category::Albums));

    setRoleNames(MediaCenter::appendAdditionalMediaRoles(roleNames()));
}
Esempio n. 3
0
Category Categories::get(const QString &name) {
    const QString path = QSettings(APP_CONFIG_PATH + "categories", QSettings::IniFormat).value(name).toString();

    if (path.isEmpty()) {
        return Category();
    }
    
    return Category(name, path.endsWith("/") ? path : path + "/");
}
// -----------------------------------------------------------------------------
// CMmMtpDpMetadataAccessWrapper::AddObjectL
// Add object (music, video, playlist and abstract media) info to DB
// -----------------------------------------------------------------------------
//
EXPORT_C void CMmMtpDpMetadataAccessWrapper::AddObjectL( const CMTPObjectMetaData& aObject )
    {
    PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL" ) );
    TMPXGeneralCategory category = Category( aObject );

    TPtrC fullFileName( aObject.DesC( CMTPObjectMetaData::ESuid ) );
    if ( category == EMPXVideo )
        {
        PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL Addvideo" ) );
        iMmMtpDpMetadataVideoAccess->AddVideoL( fullFileName );
        }
    else if ( category == EMPXPlaylist || category == EMPXAbstractAlbum )
        {
        PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL AddPlaylist/AbstractAlbum" ) );
        iMmMtpDpMetadataMpxAccess->AddAbstractMediaL( fullFileName,
            category );
        }
    else if ( category == EMPXSong )
        {
        PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL AddSong" ) );
        iMmMtpDpMetadataMpxAccess->AddSongL( fullFileName );
        }

    PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::AddObjectL" ) );
    }
// ---------------------------------------------------------------------------
// CMmMtpDpMetadataAccessWrapper::DeleteObjectL
// Deletes metadata information associated with the object
// ---------------------------------------------------------------------------
//
EXPORT_C void CMmMtpDpMetadataAccessWrapper::DeleteObjectL( const CMTPObjectMetaData& aObject )
    {
    TPtrC fileName( aObject.DesC( CMTPObjectMetaData::ESuid ) );
    PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::DeleteObjectL name = %S" ), &fileName );

    TMPXGeneralCategory category = Category( aObject );

    switch ( category )
        {
        case EMPXSong:
        case EMPXAbstractAlbum:
        case EMPXPlaylist:
            {
            iMmMtpDpMetadataMpxAccess->DeleteObjectL( fileName, category );
            }
            break;

        case EMPXVideo:
            {
            iMmMtpDpMetadataVideoAccess->DeleteRecordL( fileName );
            }
            break;

        default:
            PRINT( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::DeleteObjectL default" ) );
            break;
        }

    PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::DeleteObjectL" ) );
    }
// ---------------------------------------------------------------------------
// CMmMtpDpMetadataAccessWrapper::RenameObjectL
// Renames the file part of a record in the collection database
// ---------------------------------------------------------------------------
//
EXPORT_C void CMmMtpDpMetadataAccessWrapper::RenameObjectL( const CMTPObjectMetaData& aOldObject,
    const TDesC& aNewFileName )
    {
    TPtrC oldFileName( aOldObject.DesC( CMTPObjectMetaData::ESuid ) );
    PRINT2( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::RenameObjectL old = %S, new = %S" ),
        &oldFileName,
        &aNewFileName );

    TMPXGeneralCategory category = Category( aOldObject );
    switch ( category )
        {
        case EMPXSong:
        case EMPXAbstractAlbum:
        case EMPXPlaylist:
            {
            iMmMtpDpMetadataMpxAccess->RenameObjectL( oldFileName,
                aNewFileName,
                category );
            }
            break;
        case EMPXVideo:
            iMmMtpDpMetadataVideoAccess->RenameRecordL( oldFileName, aNewFileName );
            break;
        default:
            break;
        }


    PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RenameObjectL" ) );
    }
// ---------------------------------------------------------------------------
// CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL
// Sets a piece of metadata in the collection
// ---------------------------------------------------------------------------
//
void CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL( const TUint16 aPropCode,
    const MMTPType& aNewData,
    const CMTPObjectMetaData& aObjectMetaData )
    {
    PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL" ) );

    TMPXGeneralCategory category = Category( aObjectMetaData );
    switch ( category )
        {
        case EMPXAbstractAlbum:
        case EMPXSong:
        case EMPXPlaylist:
            iMmMtpDpMetadataMpxAccess->SetObjectMetadataValueL( aPropCode,
                aNewData,
                aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ),
                category );
            break;
        case EMPXVideo:
            iMmMtpDpMetadataVideoAccess->SetObjectMetadataValueL( aPropCode,
                aNewData,
                aObjectMetaData );
            break;
        default:
            break;
        }

    PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL" ) );
    }
TIntegrationEvent::TIntegrationEvent(	char *name,
    char *short_name,
    INT_TIME time,
    long code,
    int priority,
    TIntegrationEventCategory category)
/* --------------------------
     * Author  : Bruno Orsier                : Original Delphi code
             Diego Segura / Gilles Orazi : C++ translation
 * Created : 06/2002
 * Purpose :
 * History :
 * -------------------------- */
{
    assert(strlen(name) < INT_MAX_STRING_LENGTH);
    assert(strlen(short_name) < INT_MAX_SHORT_STRING_LENGTH);
    Name(name);
    Time(time);
    Code(code);
    m_priority = priority;
    ShortName(short_name);
    Category(category);
#ifdef INTEGR_DEBUG
    ++Glob_InEventsCount;
    ++Glob_InEventsTotal;
#endif
}
Esempio n. 9
0
static void CompressBlock(JPEGCompressor *self,int comp,
const JPEGBlock *current,const JPEGBlock *north,const JPEGBlock *west,
const JPEGQuantizationTable *quantization)
{
	// Calculate EOB context.
	int average;
	if(!north&&!west) average=0;
	else if(!north) average=Sum(0,west);
	else if(!west) average=Sum(0,north);
	else average=(Sum(0,north)+Sum(0,west)+1)/2;

	int eobcontext=Min(Category(average),12);

	// Write EOB bits using binary tree.
	WriteBitString(&self->encoder,current->eob,6,
	self->eobbins[comp][eobcontext],
	self->eobshift);

	// Compress AC components in decreasing order, if any.
	for(unsigned int k=current->eob;k>=1;k--)
	{
		CompressACComponent(self,comp,k,k!=current->eob,current,north,west,quantization);
	}

	// Compress DC component.
	CompressDCComponent(self,comp,current,north,west,quantization);
}
void CSkinManager::RefreshAllSkins(bool bReload)
{
	Combo()->Refresh();
	MainFrame()->Refresh();
	FavorBar()->Refresh();
	MenuBar()->Refresh();
	Tab()->Refresh();
	Category()->Refresh();
	Toolbar()->Refresh();
	HelpButton()->Refresh();
	LoadButton()->Refresh();
	LoginButton()->Refresh();
	SepButton()->Refresh();
	SettingButton()->Refresh();
	BigButton()->Refresh();
	SSLLockButton()->Refresh();
	StatusBar()->Refresh();
	Tooltip()->Refresh();
	MenuButton()->Refresh();
	LogoButton()->Refresh();
	Common()->Refresh(bReload);

	BackButton()->Refresh();
	ForwardButton()->Refresh();
	RefreshButton()->Refresh();

	CoolMenuSkin()->Refresh();
}
Esempio n. 11
0
int Stick::Worth() const
{
    int worth = Category()->worth();
    worth += 20 * charges();
    if (!is_known())
        worth /= 2;
    return worth;
}
// ---------------------------------------------------------------------------
// CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL
// Gets a piece of metadata from the collection
// ---------------------------------------------------------------------------
//
EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL( const TUint16 aPropCode,
    MMTPType& aNewData,
    const CMTPObjectMetaData& aObjectMetaData )
    {
    PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL" ) );

    TMPXGeneralCategory category = Category( aObjectMetaData );
    switch ( category )
        {
        case EMPXAbstractAlbum:
            if ( aPropCode == EMTPObjectPropCodeDateAdded && EMTPTypeString == aNewData.Type() )
                {
                TBuf<KMtpMaxDateTimeStringLength> timeStr;
                MmMtpDpUtility::GetObjectDateModifiedL( iFs,
                    aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ),
                    timeStr );
                PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL Date time %S" ), &timeStr );

                ( ( CMTPTypeString & ) aNewData ).SetL( timeStr );
                break;
                }
            // else
            // Fall through on purpoe to get from mpx
        case EMPXPlaylist:
        case EMPXSong:
            {
            iMmMtpDpMetadataMpxAccess->GetObjectMetadataValueL( aPropCode,
                aNewData,
                aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ),
                category );
            }
            break;
        case EMPXVideo:
            if ( aPropCode == EMTPObjectPropCodeDateAdded && EMTPTypeString == aNewData.Type() )
                {
                TBuf<KMtpMaxDateTimeStringLength> timeStr;
                MmMtpDpUtility::GetObjectDateModifiedL( iFs,
                    aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ),
                    timeStr );
                PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL Date time %S" ), &timeStr );

                ( ( CMTPTypeString & ) aNewData ).SetL( timeStr );
                }
            else
                {
                iMmMtpDpMetadataVideoAccess->GetObjectMetadataValueL( aPropCode,
                    aNewData,
                    aObjectMetaData );
                }
            break;
        default:
            // do nothing
            break;
        }

    PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL" ) );
    }
Esempio n. 13
0
bool Parser::categoryFromNode(const XMLNode& categoryNode, Category& categoryInfo)
{
  if (!categoryNode.isElementNode()
      or (categoryNode.getNameAsString() != "category"))
    return false;

  const auto attributes = categoryNode.getAttributes();
  if (attributes.empty())
  {
    std::cout << "Category element should have at least one attribute!" << std::endl;
    return false;
  } //if not enough attributes

  //initialize element with empty values
  categoryInfo = Category();
  for (const auto& a : attributes)
  {
    const std::string attrName = a.first;
    if (attrName == "term")
    {
      if (!categoryInfo.term().empty())
      {
        std::cout << "Category element already has a term!" << std::endl;
        return false;
      } //if term was already specified
      categoryInfo.setTerm(a.second);
    } //if term
    else if (attrName == "scheme")
    {
      if (!categoryInfo.scheme().empty())
      {
        std::cout << "Category element already has a scheme!" << std::endl;
        return false;
      } //if scheme was already specified
      categoryInfo.setScheme(a.second);
    } //if scheme
    else if (attrName == "label")
    {
      if (!categoryInfo.label().empty())
      {
        std::cout << "Category element already has a label!" << std::endl;
        return false;
      } //if label was already specified
      categoryInfo.setLabel(a.second);
    } //if label
    else
    {
      std::cout << "Error: found unknown attribute " << a.first
                << " in <category> element of Atom 1.0 feed!" << std::endl;
      return false;
    }
  } //for

  //Category should not be empty.
  return (!categoryInfo.empty());
}
Esempio n. 14
0
void Pet::fromJson(nlohmann::json& val)
{
    if(val.find("id") != val.end())
    {
        setId(val.at("id"));
    }
    if(val.find("category") != val.end())
    {
        if(!val["category"].is_null())
        {
            Category newItem(Category());
            newItem.fromJson(val["category"]);
            setCategory( newItem );
        }
        
    }
    setName(val.at("name"));
    {
        m_PhotoUrls.clear();
        nlohmann::json jsonArray;
                for( auto& item : val["photoUrls"] )
        {
            m_PhotoUrls.push_back(item);
            
        }
    }
    {
        m_Tags.clear();
        nlohmann::json jsonArray;
        if(val.find("tags") != val.end())
        {
        for( auto& item : val["tags"] )
        {
            
            if(item.is_null())
            {
                m_Tags.push_back( Tag(nullptr) );
            }
            else
            {
                Tag newItem(Tag());
                newItem.fromJson(item);
                m_Tags.push_back( newItem );
            }
            
        }
        }
    }
    if(val.find("status") != val.end())
    {
        setStatus(val.at("status"));
        
    }
    
}
Esempio n. 15
0
CategoryList Categories::get() {
    QSettings categories(APP_CONFIG_PATH + "categories", QSettings::IniFormat);
    CategoryList list;
    
    foreach (const QString &name, categories.childKeys()) {
        const QString path = categories.value(name).toString();
        list << Category(name, path.endsWith("/") ? path : path + "/");
    }

    return list;
}
// -----------------------------------------------------------------------------
// CMmMtpDpMetadataMpxAccess::GetImageObjPropL
// get image specific properties specific to videos
// -----------------------------------------------------------------------------
//
void CMmMtpDpMetadataAccessWrapper::GetImageObjPropL( const CMTPObjectMetaData& aObject,
    TUint32& aWidth,
    TUint32& aHeight )
    {
    TMPXGeneralCategory category = Category( aObject );
    if ( category == EMPXVideo )
        {
        TPtrC fullFileName( aObject.DesC( CMTPObjectMetaData::ESuid ) );
        iMmMtpDpMetadataVideoAccess->SetStorageRootL( fullFileName );
        iMmMtpDpMetadataVideoAccess->GetImageObjPropL( fullFileName, aWidth, aHeight );
        }
    }
Esempio n. 17
0
FConfigVariableCategory* FConfigVariableManager::GetVariablesCategory(const std::string& CategoryName, bool bCreateIfNotExisting)
{
	FFindCategoryByName SearchFunctor(CategoryName);
	FConfigVariableCategory* Result = Categories.Find(SearchFunctor);
	if (Result == nullptr && bCreateIfNotExisting)
	{
		FConfigVariableCategory Category(CategoryName);
		Categories.Add(Category);
		return &Categories.Last();
	}
	return Result;
}
Esempio n. 18
0
/*!
    \internal
*/
int QDesignerWidgetBoxInterface::findOrInsertCategory(const QString &categoryName)
{
    int count = categoryCount();
    for (int index=0; index<count; ++index) {
        Category c = category(index);
        if (c.name() == categoryName)
            return index;
    }

    addCategory(Category(categoryName));
    return count;
}
Esempio n. 19
0
DtPrinterContainer *DtPrinterIcon::CreateContainer()
{
   if (!container)
    {
      container = new DtPrinterContainer((char *)Category(), this,
                                         queue->DisplayName());
      mainw->RegisterPopup(container);
      container->dnd = new DtDND(container, DndCB);
      container->ApplicationData = queue;
      ApplicationData = container;
    }
   return container;
}
Esempio n. 20
0
int Ring::Worth() const
{
    int worth = Category()->worth();
    if (UsesBonuses()) {
        if (get_ring_level() > 0)
            worth += get_ring_level() * 100;
        else
            worth = 10;
    }
    if (!is_known())
        worth /= 2;
    return worth;
}
Esempio n. 21
0
/**
Récupère tous les "objets" catégorie et retourne une QList, ces objets category
chargent a leurs instanciation les snippet et le langage qu'elles contiennent
**/
QList<Category> Category::loadAll(){
    Log::put("Recuperation des objets de catégories",2);
    QList<Category> categories  = QList<Category>();
    QStringList categoriesName = Category::getAll();
    foreach(QString categoryName,categoriesName){
        QStringList catInfos = categoryName.split(CATEGORY_LANGAGE_SEPARATOR);
        Category category = Category();
        category.setName(catInfos.at(0));
        category.setLangage((catInfos.size()>1?catInfos.at(1):"Default"));
        Log::put("Catégorie "+categoryName,3);
        category.loadLangage();
        category.loadSnippet();
        categories.append(category);
    }
Esempio n. 22
0
void CSMPrefs::State::declareCategory (const std::string& key)
{
    std::map<std::string, Category>::iterator iter = mCategories.find (key);

    if (iter!=mCategories.end())
    {
        mCurrentCategory = iter;
    }
    else
    {
        mCurrentCategory =
            mCategories.insert (std::make_pair (key, Category (this, key))).first;
    }
}
Esempio n. 23
0
QList<Category> Item::categories() const
{
    QList<QDomElement> cats = elementsByTagNameNS(QString(),
            QLatin1String("category"));

    QList<Category> categories;

    QList<QDomElement>::ConstIterator it = cats.constBegin();
    for ( ; it != cats.constEnd(); ++it)
    {
        categories.append(Category(*it));
    }
    return categories;
}
// -----------------------------------------------------------------------------
// CMmMtpDpMetadataAccessWrapper::SetReferenceL
// Set abstract media to DB
// -----------------------------------------------------------------------------
//
EXPORT_C void CMmMtpDpMetadataAccessWrapper::SetReferenceL( const CMTPObjectMetaData& aObject,
    CDesCArray& aRefFileArray )
    {
    TPtrC refOwner( aObject.DesC( CMTPObjectMetaData::ESuid ) );
    PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetReferenceL reference owner = %S" ),
        &refOwner );

    TMPXGeneralCategory category = Category( aObject );
    if ( category == EMPXPlaylist || category == EMPXAbstractAlbum )
        {
        iMmMtpDpMetadataMpxAccess->SetReferenceL( refOwner, aRefFileArray, category );
        }

    PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::SetReferenceL" ) );
    }
Esempio n. 25
0
bool JSONModel::dropMimeData(
        const QMimeData *data,
        Qt::DropAction action,
        int row,
        int column,
        const QModelIndex &parent)
{
    beginInsertRows(parent, elements.size(), elements.size());
    elements.push_back(
                LibraryElement
                    {"Name me!",
                     categoryMimeTypeMap().key(data->formats().first(), Category(-1)),
                     {"no tags"},
                     QJsonObject{}});
    endInsertRows();
    return false;
}
Esempio n. 26
0
QList<Category> Source::categories() const
{
    QList<QDomElement> a = 
            elementsByTagNameNS(atom1Namespace(),
                                QLatin1String("category"));
    QList<Category> list;
    
    QList<QDomElement>::ConstIterator it = a.constBegin();
    QList<QDomElement>::ConstIterator end = a.constEnd();


    for ( ; it != end; ++it)
    {
        list.append(Category(*it));
    }

    return list;
}
Esempio n. 27
0
TIntegrationEvent::TIntegrationEvent( const TIntegrationEvent &source )
/* --------------------------
     * Author  : Bruno Orsier                : Original Delphi code
             Diego Segura / Gilles Orazi : C++ translation
 * Created : 06/2002
 * Purpose :
 * History :
 * -------------------------- */
{
    Name(source.Name());
    Time(source.Time());
    Code(source.Code());
    m_priority = source.Priority();
    ShortName(source.ShortName());
    Category(source.Category());
#ifdef INTEGR_DEBUG
    ++Glob_InEventsCount;
    ++Glob_InEventsTotal;
#endif
}
Esempio n. 28
0
TIntegrationEvent& TIntegrationEvent::operator=(const TIntegrationEvent& source)
/* --------------------------
     * Author  : Bruno Orsier                : Original Delphi code
             Diego Segura / Gilles Orazi : C++ translation
 * Created : 06/2002
 * Purpose :
 * History :
 * -------------------------- */
{
    if( this != &source )
    {
        Name(source.Name());
        Time(source.Time());
        Code(source.Code());
        m_priority = source.Priority();
        ShortName(source.ShortName());
        Category(source.Category());
    }

    return *this;
}
Esempio n. 29
0
std::string Stick::InventoryName() const
{
    std::ostringstream ss;

    ItemCategory& info = *Category();

    if (info.is_discovered() || game->wizard().reveal_items()) {
        ss << "A " << info.kind() << " of " << info.name() << get_charge_string(this);
        if (!short_msgs())
            ss << "(" << info.identifier() << ")";
    }
    else if (!info.guess().empty()) {
        ss << "A " << info.kind() << " called " << info.guess();
        if (!short_msgs())
            ss << "(" << info.identifier() << ")";
    }
    else
        ss << "A " << info.identifier() << " " << info.kind();

    return ss.str();
}
Esempio n. 30
0
bool DbNote::selectCategories(string where = "")
{
    sqlite3_stmt *statement;
    clearCategoryCache();
    string stmnt = "select KatKey,KatDesc from KatTable ";
    if (where.length() > 0)
        stmnt += where;
    if (!openDB())
    {
        throw SQLError("Can't open the DB-Connection");
        return false;
    }
    int req = sqlite3_prepare_v2(db, stmnt.c_str(), stmnt.length(), &statement,
                                 0);
    if (req == SQLITE_ERROR)
    {
        throw SQLError("Can't select data of the given table");
        return false;
    }
    sqlite3_column_count(statement);

    do
    {
        req = sqlite3_step(statement);
        Category cat = Category();
        if (req == SQLITE_ROW)
        {
            cat.setKatKey((int) sqlite3_column_int(statement, 0));
            char * str = (char *) sqlite3_column_text(statement, 1);
            if (str != NULL)
                cat.setKatDesc(str);
            categories.push_back(cat);
        }
        //std::cout << cat.getDesc() << "\n";
    }
    while (req == SQLITE_ROW);
    sqlite3_finalize(statement);
    sqlite3_close(db);
    return true;
}