Back to index

unity  6.0.0
Preview.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2011 Canonical Ltd
00004  *
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 3 as
00007  * published by the Free Software Foundation.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  *
00017  * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
00018  */
00019 
00020 #ifndef UNITY_PREVIEW_H
00021 #define UNITY_PREVIEW_H
00022 
00023 #include <map>
00024 #include <memory>
00025 #include <string>
00026 #include <vector>
00027 
00028 #include <sigc++/trackable.h>
00029 
00030 #include <glib.h>
00031 #include "Variant.h"
00032 
00033 namespace unity
00034 {
00035 namespace dash
00036 {
00037 
00038 class Preview : public sigc::trackable
00039 {
00040 public:
00041   typedef std::shared_ptr<Preview> Ptr;
00042   typedef std::map<std::string, unity::glib::Variant> Properties;
00043 
00044   virtual ~Preview();
00045 
00046   static Preview::Ptr PreviewForProperties(std::string const& renderer_name, Properties& properties);
00047 
00048   std::string renderer_name;
00049 
00050 protected:
00051   unsigned int PropertyToUnsignedInt (Properties& properties, const char* key);
00052   std::string PropertyToString(Properties& properties, const char *key);
00053   std::vector<std::string> PropertyToStringVector(Properties& properties, const char *key);
00054   float PropertyToFloat(Properties& properties, const char* key);
00055 };
00056 
00057 class NoPreview : public Preview
00058 {
00059 public:
00060   NoPreview();
00061 };
00062 
00063 }
00064 }
00065 
00066 #endif