ov-cs-list.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2002-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_cs_list_h)
00024 #define octave_cs_list_h 1
00025 
00026 #include <cstdlib>
00027 
00028 #include <iosfwd>
00029 #include <string>
00030 
00031 #include "mx-base.h"
00032 #include "str-vec.h"
00033 
00034 #include "Cell.h"
00035 #include "error.h"
00036 #include "oct-alloc.h"
00037 #include "oct-obj.h"
00038 #include "ov-typeinfo.h"
00039 
00040 class tree_walker;
00041 
00042 // Lists.
00043 
00044 class
00045 octave_cs_list : public octave_base_value
00046 {
00047 public:
00048 
00049   octave_cs_list (void)
00050     : octave_base_value (), lst () { }
00051 
00052   octave_cs_list (const octave_value_list& l)
00053     : octave_base_value (), lst (l) { }
00054 
00055   octave_cs_list (const Cell& c);
00056 
00057   octave_cs_list (const octave_cs_list& l)
00058     : octave_base_value (), lst (l.lst) { }
00059 
00060   ~octave_cs_list (void) { }
00061 
00062   octave_base_value *clone (void) const { return new octave_cs_list (*this); }
00063   octave_base_value *empty_clone (void) const { return new octave_cs_list (); }
00064 
00065   dim_vector dims (void) const { return dim_vector (1, lst.length ()); }
00066 
00067   bool is_defined (void) const { return true; }
00068 
00069   bool is_constant (void) const { return true; }
00070 
00071   bool is_cs_list (void) const { return true; }
00072 
00073   octave_value_list list_value (void) const { return lst; }
00074 
00075   octave_value subsref (const std::string& type,
00076                         const std::list<octave_value_list>& idx);
00077 
00078   octave_value_list subsref (const std::string& type,
00079                              const std::list<octave_value_list>& idx, int);
00080 
00081 private:
00082 
00083   // The list of Octave values.
00084   octave_value_list lst;
00085 
00086   DECLARE_OCTAVE_ALLOCATOR
00087 
00088   DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
00089 };
00090 
00091 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines