Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MetadataPair.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2003-2004 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010  */
00011 
00012 
00013 //
00014 // MetadataPair
00015 //
00016 // 12 May 2004 -- tds
00017 //
00018 
00019 #ifndef INDRI_METADATAPAIR_HPP
00020 #define INDRI_METADATAPAIR_HPP
00021 
00022 #include <string.h>
00023 #include <ctype.h>
00024 namespace indri
00025 {
00026   namespace parse
00027   {
00028     
00029     struct MetadataPair {
00030       const char* key;
00031       const void* value;
00032       int valueLength;
00033 
00034       class key_equal {
00035         const char* k;
00036 
00037       public:
00038         key_equal( const char* key ) {
00039           k = key;
00040         }
00041 
00042         bool operator() ( const MetadataPair& pair ) {
00043           return strcmp( k, pair.key ) == 0;
00044         }
00045       };
00046 
00047       void stripValue() {
00048         while( isspace( *(char*)value ) ) {
00049           value = (char*)value + 1;
00050           valueLength -= 1;
00051         }
00052 
00053         while( isspace( ((char*)value)[valueLength-2] ) ) {
00054           valueLength -= 1;
00055           ((char*)value)[valueLength-1] = 0;
00056         }
00057       }
00058     };
00059   }
00060 }
00061 
00062 #endif // INDRI_METADATAPAIR_HPP

Generated on Tue Jun 15 11:02:54 2010 for Lemur by doxygen 1.3.4