⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcutil.3

📁 Tokyo Cabinet的Tokyo Cabinet 是一个DBM的实现。这里的数据库由一系列key-value对的记录构成。key和value都可以是任意长度的字节序列,既可以是二进制也可以是字符
💻 3
📖 第 1 页 / 共 5 页
字号:
If successful, the return value is true, else, it is false..RE.RSIf a record with the same key exists in the map, this function has no effect..RE.RE.PPThe function `tcmapputkeep2' is used in order to store a new string record into a map object..PP.RS.br\fBbool tcmapputkeep2(TCMAP *\fImap\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RS`\fIvstr\fR' specifies the string of the value..RE.RSIf successful, the return value is true, else, it is false..RE.RSIf a record with the same key exists in the map, this function has no effect..RE.RE.PPThe function `tcmapputcat' is used in order to concatenate a value at the end of the value of the existing record in a map object..PP.RS.br\fBvoid tcmapputcat(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIvbuf\fR' specifies the pointer to the region of the value..RE.RS`\fIvsiz\fR' specifies the size of the region of the value..RE.RSIf there is no corresponding record, a new record is created..RE.RE.PPThe function `tcmapputcat2' is used in order to concatenate a string value at the end of the value of the existing record in a map object..PP.RS.br\fBvoid tcmapputcat2(TCMAP *\fImap\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RS`\fIvstr\fR' specifies the string of the value..RE.RSIf there is no corresponding record, a new record is created..RE.RE.PPThe function `tcmapout' is used in order to remove a record of a map object..PP.RS.br\fBbool tcmapout(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RSIf successful, the return value is true.  False is returned when no record corresponds to the specified key..RE.RE.PPThe function `tcmapout2' is used in order to remove a string record of a map object..PP.RS.br\fBbool tcmapout2(TCMAP *\fImap\fB, const char *\fIkstr\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RSIf successful, the return value is true.  False is returned when no record corresponds to the specified key..RE.RE.PPThe function `tcmapget' is used in order to retrieve a record in a map object..PP.RS.br\fBconst void *tcmapget(const TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int *\fIsp\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSIf successful, the return value is the pointer to the region of the value of the corresponding record.  `NULL' is returned when no record corresponds..RE.RSBecause an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string..RE.RE.PPThe function `tcmapget2' is used in order to retrieve a string record in a map object..PP.RS.br\fBconst char *tcmapget2(const TCMAP *\fImap\fB, const char *\fIkstr\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RSIf successful, the return value is the string of the value of the corresponding record.  `NULL' is returned when no record corresponds..RE.RE.PPThe function `tcmapmove' is used in order to move a record to the edge of a map object..PP.RS.br\fBbool tcmapmove(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, bool \fIhead\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of a key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIhead\fR' specifies the destination which is the head if it is true or the tail if else..RE.RSIf successful, the return value is true.  False is returned when no record corresponds to the specified key..RE.RE.PPThe function `tcmapmove2' is used in order to move a string record to the edge of a map object..PP.RS.br\fBbool tcmapmove2(TCMAP *\fImap\fB, const char *\fIkstr\fB, bool \fIhead\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkstr\fR' specifies the string of a key..RE.RS`\fIhead\fR' specifies the destination which is the head if it is true or the tail if else..RE.RSIf successful, the return value is true.  False is returned when no record corresponds to the specified key..RE.RE.PPThe function `tcmapiterinit' is used in order to initialize the iterator of a map object..PP.RS.br\fBvoid tcmapiterinit(TCMAP *\fImap\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RSThe iterator is used in order to access the key of every record stored in the map object..RE.RE.PPThe function `tcmapiternext' is used in order to get the next key of the iterator of a map object..PP.RS.br\fBconst void *tcmapiternext(TCMAP *\fImap\fB, int *\fIsp\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSIf successful, the return value is the pointer to the region of the next key, else, it is `NULL'.  `NULL' is returned when no record can be fetched from the iterator..RE.RSBecause an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string.  The order of iteration is assured to be the same as the stored order..RE.RE.PPThe function `tcmapiternext2' is used in order to get the next key string of the iterator of a map object..PP.RS.br\fBconst char *tcmapiternext2(TCMAP *\fImap\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RSIf successful, the return value is the pointer to the region of the next key, else, it is `NULL'.  `NULL' is returned when no record can be fetched from the iterator..RE.RSThe order of iteration is assured to be the same as the stored order..RE.RE.PPThe function `tcmaprnum' is used in order to get the number of records stored in a map object..PP.RS.br\fBuint64_t tcmaprnum(const TCMAP *\fImap\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RSThe return value is the number of the records stored in the map object..RE.RE.PPThe function `tcmapmsiz' is used in order to get the total size of memory used in a map object..PP.RS.br\fBuint64_t tcmapmsiz(const TCMAP *\fImap\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RSThe return value is the total size of memory used in a map object..RE.RE.PPThe function `tcmapkeys' is used in order to create a list object containing all keys in a map object..PP.RS.br\fBTCLIST *tcmapkeys(const TCMAP *\fImap\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RSThe return value is the new list object containing all keys in the map object..RE.RSBecause the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use..RE.RE.PPThe function `tcmapvals' is used in order to create a list object containing all values in a map object..PP.RS.br\fBTCLIST *tcmapvals(const TCMAP *\fImap\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RSThe return value is the new list object containing all values in the map object..RE.RSBecause the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use..RE.RE.PPThe function `tcmapaddint' is used in order to add an integer to a record in a map object..PP.RS.br\fBint tcmapaddint(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int \fInum\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fInum\fR' specifies the additional value..RE.RSThe return value is the summation value..RE.RSIf the corresponding record exists, the value is treated as an integer and is added to.  If no record corresponds, a new record of the additional value is stored..RE.RE.PPThe function `tcmapadddouble' is used in order to add a real number to a record in a map object..PP.RS.br\fBdouble tcmapadddouble(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, double \fInum\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fInum\fR' specifies the additional value..RE.RSThe return value is the summation value..RE.RSIf the corresponding record exists, the value is treated as a real number and is added to.  If no record corresponds, a new record of the additional value is stored..RE.RE.PPThe function `tcmapclear' is used in order to clear a map object..PP.RS.br\fBvoid tcmapclear(TCMAP *\fImap\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RSAll records are removed..RE.RE.PPThe function `tcmapcutfront' is used in order to remove front records of a map object..PP.RS.br\fBvoid tcmapcutfront(TCMAP *\fImap\fB, int \fInum\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fInum\fR' specifies the number of records to be removed..RE.RE.PPThe function `tcmapdump' is used in order to serialize a map object into a byte array..PP.RS.br\fBvoid *tcmapdump(const TCMAP *\fImap\fB, int *\fIsp\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSThe return value is the pointer to the region of the result serial region..RE.RSBecause the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use..RE.RE.PPThe function `tcmapload' is used in order to create a map object from a serialized byte array..PP.RS.br\fBTCMAP *tcmapload(const void *\fIptr\fB, int \fIsize\fB);\fR.RS`\fIptr\fR' specifies the pointer to the region of serialized byte array..RE.RS`\fIsize\fR' specifies the size of the region..RE.RSThe return value is a new map object..RE.RSBecause the object of the return value is created with the function `tcmapnew', it should be deleted with the function `tcmapdel' when it is no longer in use..RE.RE.SH API OF ORDERED TREE.PPThe function `tctreenew' is used in order to create a tree object..PP.RS.br\fBTCTREE *tctreenew(void);\fR.RSThe return value is the new tree object..RE.RE.PPThe function `tctreenew2' is used in order to create a tree object with specifying the custom comparison function..PP.RS.br\fBTCTREE *tctreenew2(TCCMP \fIcmp\fB, void *\fIcmpop\fB);\fR.RS`\fIcmp\fR' specifies the pointer to the custom comparison function.  It receives five parameters.  The first parameter is the pointer to the region of one key.  The second parameter is the size of the region of one key.  The third parameter is the pointer to the region of the other key.  The fourth parameter is the size of the region of the other key.  The fifth parameter is the pointer to the optional opaque object.  It returns positive if the former is big, negative if the latter is big, 0 if both are equivalent..RE.RS`\fIcmpop\fR' specifies an arbitrary pointer to be given as a parameter of the comparison function.  If it is not needed, `NULL' can be specified..RE.RSThe return value is the new tree object..RE.RSThe default comparison function compares keys of two records by lexical order.  The functions `tccmplexical' (dafault), `tccmpdecimal', `tccmpint32', and `tccmpint64' are built\-in..RE.RE.PPThe function `tctreedup' is used in order to copy a tree object..PP.RS.br\fBTCTREE *tctreedup(const TCTREE *\fItree\fB);\fR.RS`\fItree\fR' specifies the tree object..RE.RSThe return value is the new tree object equivalent to the specified object..RE.RE.PPThe function `tctreedel' is used in order to delete a tree object..PP.RS.br\fBvoid tctreedel(TCTREE *\fItree\fB);\fR.RS`tree' specifies the tree object..RE.RSNote that the deleted object and its derivatives can not be used anymore..RE.RE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -