# gdcmStringFilter.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004   Module:  $URL$
    00005
    00006   Copyright (c) 2006-2010 Mathieu Malaterre
    00007   All rights reserved.
    00008   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
    00009
    00010      This software is distributed WITHOUT ANY WARRANTY; without even
    00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00012      PURPOSE.  See the above copyright notice for more information.
    00013
    00014 =========================================================================*/
    00015 #ifndef GDCMSTRINGFILTER_H
    00016 #define GDCMSTRINGFILTER_H
    00017
    00018 #include "gdcmDataElement.h"
    00019 #include "gdcmDicts.h"
    00020 #include "gdcmFile.h"
    00021
    00022 namespace gdcm
    00023 {
    00024
    00030 class GDCM_EXPORT StringFilter
    00031 {
    00032 public:
    00033   StringFilter();
    00034   ~StringFilter();
    00035
    00037   void UseDictAlways(bool ) {}
    00038
    00040   void SetDicts(const Dicts &dicts);
    00041
    00043   std::string ToString(const Tag& t) const;
    00044
    00045   //std::string ToMime64(const Tag& t) const;
    00046
    00051   std::pair<std::string, std::string> ToStringPair(const Tag& t) const;
    00052
    00054   std::string FromString(const Tag&t, const char * value, VL const & vl);
    00055
    00056   // Use this one
    00057   std::string FromString(const Tag&t, const char * value, size_t len);
    00058
    00059   //typedef std::map<Tag, gdcm::ConstCharWrapper> StringSet;
    00060
    00062   void SetFile(const File& f) { F = f; }
    00063   File &GetFile() { return *F; }
    00064   const File &GetFile() const { return *F; }
    00065
    00069   bool ExecuteQuery(std::string const &query, std::string & value) const;
    00070
    00071 protected:
    00072   std::pair<std::string, std::string> ToStringPair(const Tag& t, DataSet const &ds) const;
    00073   bool ExecuteQuery(std::string const &query, DataSet const &ds, std::string & value) const;
    00074
    00075 private:
    00076   SmartPointer<File> F;
    00077 };
    00078
    00079 } // end namespace gdcm
    00080
    00081 #endif //GDCMSTRINGFILTER_H