// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
-// $Id: cursesf.h,v 1.31 2012/12/29 21:49:58 tom Exp $
+// $Id: cursesf.h,v 1.37 2020/07/18 19:57:11 anonymous.maarten Exp $
#ifndef NCURSES_CURSESF_H_incl
#define NCURSES_CURSESF_H_incl 1
}
//
// -------------------------------------------------------------------------
-// The abstract base class for buitin and user defined Fieldtypes.
+// The abstract base class for builtin and user defined Fieldtypes.
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP NCursesFormField; // forward declaration
+class NCURSES_CXX_IMPEXP NCursesFormField; // forward declaration
// Class to represent builtin field types as well as C++ written new
// fieldtypes (see classes UserDefineFieldType...
-class NCURSES_IMPEXP NCursesFieldType
+class NCURSES_CXX_IMPEXP NCursesFieldType
{
friend class NCursesFormField;
// The class representing a forms field, wrapping the lowlevel FIELD struct
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP NCursesFormField
+class NCURSES_CXX_IMPEXP NCursesFormField
{
friend class NCursesForm;
{
}
- virtual ~NCursesFormField ();
+ virtual ~NCursesFormField () THROWS(NCursesException);
// Duplicate the field at a new position
inline NCursesFormField* dup(int first_row, int first_col)
// The class representing a form, wrapping the lowlevel FORM struct
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP NCursesForm : public NCursesPanel
+class NCURSES_CXX_IMPEXP NCursesForm : public NCursesPanel
{
protected:
FORM* form; // the lowlevel structure
{
}
- virtual ~NCursesForm();
+ virtual ~NCursesForm() THROWS(NCursesException);
// Set the default attributes for the form
virtual void setDefaultAttributes();
// data belongs to some class T. Use T as template argument
// to create a UserField.
// -------------------------------------------------------------------------
-template<class T> class NCURSES_IMPEXP NCursesUserField : public NCursesFormField
+template<class T> class NCURSES_CXX_IMPEXP NCursesUserField : public NCursesFormField
{
public:
NCursesUserField (int rows,
OnError(::set_field_userptr(field, STATIC_CAST(void *)(p_UserData)));
}
- virtual ~NCursesUserField() {};
+ virtual ~NCursesUserField() THROWS(NCursesException) {};
inline const T* UserData (void) const {
return reinterpret_cast<const T*>(::field_userptr (field));
// The same mechanism is used to attach user data to a form
// -------------------------------------------------------------------------
//
-template<class T> class NCURSES_IMPEXP NCursesUserForm : public NCursesForm
+template<class T> class NCURSES_CXX_IMPEXP NCursesUserForm : public NCursesForm
{
protected:
// 'Internal' constructor, builds an object without association to a
const T* p_UserData = STATIC_CAST(T*)(0))
: NCursesForm(nlines,ncols,begin_y,begin_x) {
if (form)
- set_user (const_cast<void *>(p_UserData));
+ set_user (const_cast<void *>(reinterpret_cast<const void*>
+ (p_UserData)));
}
public:
bool autoDelete_Fields=FALSE)
: NCursesForm (Fields, with_frame, autoDelete_Fields) {
if (form)
- set_user (const_cast<void *>(p_UserData));
+ set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
};
NCursesUserForm (NCursesFormField* Fields[],
: NCursesForm (Fields, nlines, ncols, begin_y, begin_x,
with_frame, autoDelete_Fields) {
if (form)
- set_user (const_cast<void *>(p_UserData));
+ set_user (const_cast<void *>(reinterpret_cast<const void*>
+ (p_UserData)));
};
- virtual ~NCursesUserForm() {
+ virtual ~NCursesUserForm() THROWS(NCursesException) {
};
- inline T* UserData (void) const {
+ inline T* UserData (void) {
return reinterpret_cast<T*>(get_user ());
};
inline virtual void setUserData (const T* p_UserData) {
if (form)
- set_user (const_cast<void *>(p_UserData));
+ set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
}
};
// Builtin Fieldtypes
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Alpha_Field : public NCursesFieldType
{
private:
int min_field_width;
}
};
-class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Alphanumeric_Field : public NCursesFieldType
{
private:
int min_field_width;
}
};
-class NCURSES_IMPEXP Integer_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Integer_Field : public NCursesFieldType
{
private:
int precision;
}
};
-class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Numeric_Field : public NCursesFieldType
{
private:
int precision;
}
};
-class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Regular_Expression_Field : public NCursesFieldType
{
private:
char* regex;
}
};
-class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP Enumeration_Field : public NCursesFieldType
{
private:
const char** list;
}
};
-class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType
+class NCURSES_CXX_IMPEXP IPV4_Address_Field : public NCursesFieldType
{
private:
void set(NCursesFormField& f) {
// Abstract base class for User-Defined Fieldtypes
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType
+class NCURSES_CXX_IMPEXP UserDefinedFieldType : public NCursesFieldType
{
friend class UDF_Init; // Internal helper to set up statics
private:
virtual bool char_check (int c) = 0;
public:
- UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) {
- }
+ UserDefinedFieldType();
};
extern "C" {
// Abstract base class for User-Defined Fieldtypes with Choice functions
// -------------------------------------------------------------------------
//
-class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType
+class NCURSES_CXX_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType
{
friend class UDF_Init; // Internal helper to set up statics
private:
virtual bool previous(NCursesFormField& f) = 0;
public:
- UserDefinedFieldType_With_Choice() {
- fieldtype = generic_fieldtype_with_choice;
- }
+ UserDefinedFieldType_With_Choice();
};
#endif /* NCURSES_CURSESF_H_incl */