yast2-storage

StorageCallbacks.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) [2004-2009] Novell, Inc.
00003  *
00004  * All Rights Reserved.
00005  *
00006  * This program is free software; you can redistribute it and/or modify it
00007  * under the terms of version 2 of the GNU General Public License as published
00008  * by the Free Software Foundation.
00009  *
00010  * This program is distributed in the hope that it will be useful, but WITHOUT
00011  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00013  * more details.
00014  *
00015  * You should have received a copy of the GNU General Public License along
00016  * with this program; if not, contact Novell, Inc.
00017  *
00018  * To contact Novell about this file by physical or electronic mail, you may
00019  * find current contact information at www.novell.com.
00020  */
00021 
00022 
00023 /*---------------------------------------------------------------------\
00024 |                                                                      |
00025 |                      __   __    ____ _____ ____                      |
00026 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00027 |                       \ V / _` \___ \ | |   __) |                    |
00028 |                        | | (_| |___) || |  / __/                     |
00029 |                        |_|\__,_|____/ |_| |_____|                    |
00030 |                                                                      |
00031 |                               core system                            |
00032 |                                                        (C) SuSE GmbH |
00033 \----------------------------------------------------------------------/
00034 
00035    File:        StorageCallbacks.h
00036 
00037    Author:      Klaus Kaempf <kkaempf@suse.de>
00038                 Stanislav Visnovsky <visnov@suse.cz>
00039    Maintainer:  Klaus Kaempf <kkaempf@suse.de>
00040 
00041    Purpose:     Access to the storage callbacks
00042                 Handles StorageCallbacks::function (list_of_arguments) calls
00043 /-*/
00044 
00045 #ifndef StorageCallbacks_h
00046 #define StorageCallbacks_h
00047 
00048 #include <string>
00049 
00050 #include <ycp/YCPBoolean.h>
00051 #include <ycp/YCPValue.h>
00052 #include <ycp/YCPList.h>
00053 #include <ycp/YCPMap.h>
00054 #include <ycp/YCPSymbol.h>
00055 #include <ycp/YCPString.h>
00056 #include <ycp/YCPInteger.h>
00057 #include <ycp/YCPVoid.h>
00058 #include <ycp/YBlock.h>
00059 
00060 #include <y2/Y2Namespace.h>
00061 
00065 class StorageCallbacks : public Y2Namespace
00066 {
00067 public:
00068 
00069     // builtin handling
00070     void registerFunctions ();
00071     vector<string> _registered_functions;
00072 
00073     // callbacks
00074     /* TYPEINFO: void(string) */
00075     YCPValue ProgressBar (const YCPString& func);
00076     /* TYPEINFO: void(string) */
00077     YCPValue ShowInstallInfo (const YCPString& func);
00078     /* TYPEINFO: void(string) */
00079     YCPValue InfoPopup (const YCPString& func);
00080     /* TYPEINFO: void(string) */
00081     YCPValue YesNoPopup (const YCPString& func);
00082     /* TYPEINFO: void(string) */
00083     YCPValue CommitErrorPopup (const YCPString& func);
00084     /* TYPEINFO: void(string) */
00085     YCPValue PasswordPopup (const YCPString& func);
00086 
00090     StorageCallbacks ();
00091 
00095     virtual ~StorageCallbacks ();
00096 
00097     virtual const string name () const
00098     {
00099         return "StorageCallbacks";
00100     }
00101 
00102     virtual const string filename () const
00103     {
00104         return "StorageCallbacks";
00105     }
00106 
00107     virtual string toString () const
00108     {
00109         return "// not possible toString";
00110     }
00111 
00112     virtual YCPValue evaluate (bool cse = false)
00113     {
00114         if (cse) return YCPNull ();
00115         else return YCPVoid ();
00116     }
00117 
00118     virtual Y2Function* createFunctionCall (const string name, constFunctionTypePtr type);
00119 
00120     static StorageCallbacks* instance ();
00121 
00122 private:
00123 
00124     static StorageCallbacks* current_instance;
00125 
00126 };
00127 
00128 #endif // StorageCallbacks_h