libQtCassandra 0.3.2
|
00001 /* 00002 * Header: 00003 * QCassandraColumnDefinitions.h 00004 * 00005 * Description: 00006 * Handling of the cassandra::ColumnDef. 00007 * 00008 * Documentation: 00009 * See the corresponding .cpp file. 00010 * 00011 * License: 00012 * Copyright (c) 2011 Made to Order Software Corp. 00013 * 00014 * http://snapwebsites.org/ 00015 * contact@m2osw.com 00016 * 00017 * Permission is hereby granted, free of charge, to any person obtaining a 00018 * copy of this software and associated documentation files (the 00019 * "Software"), to deal in the Software without restriction, including 00020 * without limitation the rights to use, copy, modify, merge, publish, 00021 * distribute, sublicense, and/or sell copies of the Software, and to 00022 * permit persons to whom the Software is furnished to do so, subject to 00023 * the following conditions: 00024 * 00025 * The above copyright notice and this permission notice shall be included 00026 * in all copies or substantial portions of the Software. 00027 * 00028 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00029 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00030 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00031 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 00032 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00033 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00034 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00035 */ 00036 #ifndef QCASSANDRA_COLUMN_DEFINITION_H 00037 #define QCASSANDRA_COLUMN_DEFINITION_H 00038 00039 #include <QObject> 00040 #include <QString> 00041 #include <QMap> 00042 #include <QSharedPointer> 00043 #include <memory> 00044 00045 namespace QtCassandra 00046 { 00047 00048 class QCassandraTable; 00049 class QCassandraColumnDefinitionPrivate; 00050 00051 00052 // Cassandra ColumnDef 00053 class QCassandraColumnDefinition : public QObject 00054 { 00055 public: 00056 enum index_type_t { 00057 INDEX_TYPE_UNKNOWN = -2, 00058 INDEX_TYPE_UNDEFINED = -1, 00059 INDEX_TYPE_KEYS = 0 00060 }; 00061 00062 virtual ~QCassandraColumnDefinition(); 00063 00064 QString columnName() const; 00065 00066 void setValidationClass(const QString& name); 00067 QString validationClass() const; 00068 00069 void setIndexType(index_type_t index_type); 00070 void unsetIndexType(); 00071 index_type_t indexType() const; 00072 00073 void setIndexName(const QString& name); 00074 void unsetIndexName(); 00075 QString indexName() const; 00076 00077 private: 00078 QCassandraColumnDefinition(QCassandraTable *table, const QString& name); 00079 00080 void parseColumnDefinition(const void *data); 00081 void prepareColumnDefinition(void *data) const; 00082 00083 friend class QCassandraTable; 00084 friend class QCassandraColumnDefinitionPrivate; 00085 00086 std::auto_ptr<QCassandraColumnDefinitionPrivate> f_private; 00087 // f_table is a parent that has a strong shared pointer over us so it 00088 // cannot disappear before we do, thus only a bare pointer is enough here 00089 // (there isn't a need to use a QWeakPointer or QPointer either) 00090 QCassandraTable * f_table; 00091 }; 00092 00093 // array of column definitions 00094 typedef QMap<QString, QSharedPointer<QCassandraColumnDefinition> > QCassandraColumnDefinitions; 00095 00096 00097 00098 } // namespace QtCassandra 00099 #endif 00100 //#ifndef QCASSANDRA_COLUMN_DEFINITION_H 00101 // vim: ts=4 sw=4 et
This document is part of the libQtCassandra Project.
Copyright by Made to Order Software Corp.