Merge pull request #385 from eladsal/dev-title
Add new function to get and set title strings
This commit is contained in:
@@ -257,6 +257,8 @@ Public Const EN_R_IS_ACTIVE = 3
|
|||||||
Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Long, count As Long) As Long
|
Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Long, count As Long) As Long
|
||||||
Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Long, ByVal errmsg As String, ByVal maxLen As Long) As Long
|
Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Long, ByVal errmsg As String, ByVal maxLen As Long) As Long
|
||||||
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type_ As Long, ByRef value As Single) As Long
|
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type_ As Long, ByRef value As Single) As Long
|
||||||
|
Declare Function ENgettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Long
|
||||||
|
Declare Function ENsettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Long
|
||||||
|
|
||||||
'Analysis Options Functions
|
'Analysis Options Functions
|
||||||
Declare Function ENgetoption Lib "epanet2.dll" (ByVal option_ As Long, value As Single) As Long
|
Declare Function ENgetoption Lib "epanet2.dll" (ByVal option_ As Long, value As Single) As Long
|
||||||
|
|||||||
@@ -145,6 +145,10 @@ extern "C" {
|
|||||||
|
|
||||||
int DLLEXPORT ENgetstatistic(int type, EN_API_FLOAT_TYPE* value);
|
int DLLEXPORT ENgetstatistic(int type, EN_API_FLOAT_TYPE* value);
|
||||||
|
|
||||||
|
int DLLEXPORT ENgettitle(char *titleline1, char *titleline2, char *titleline3);
|
||||||
|
|
||||||
|
int DLLEXPORT ENsettitle(char *titleline1, char *titleline2, char *titleline3);
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
|
|
||||||
Analysis Options Functions
|
Analysis Options Functions
|
||||||
|
|||||||
@@ -262,6 +262,8 @@ Public Const EN_R_IS_ACTIVE = 3
|
|||||||
Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Int32, count As Int32) As Int32
|
Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Int32, count As Int32) As Int32
|
||||||
Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Int32, ByVal errmsg As String, ByVal maxLen As Int32) As Int32
|
Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Int32, ByVal errmsg As String, ByVal maxLen As Int32) As Int32
|
||||||
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type_ As Int32, ByRef value As Single) As Int32
|
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type_ As Int32, ByRef value As Single) As Int32
|
||||||
|
Declare Function ENgettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Int32
|
||||||
|
Declare Function ENsettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Int32
|
||||||
|
|
||||||
'Analysis Options Functions
|
'Analysis Options Functions
|
||||||
Declare Function ENgetoption Lib "epanet2.dll" (ByVal option As Int32, value As Single) As Int32
|
Declare Function ENgetoption Lib "epanet2.dll" (ByVal option As Int32, value As Single) As Int32
|
||||||
|
|||||||
@@ -580,6 +580,24 @@ typedef struct Project *EN_Project;
|
|||||||
*/
|
*/
|
||||||
int DLLEXPORT EN_getstatistic(EN_Project ph, int type, double* value);
|
int DLLEXPORT EN_getstatistic(EN_Project ph, int type, double* value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Retrieves the title lines of the project
|
||||||
|
@param[out] titleline1 first title line
|
||||||
|
@param[out] titleline2 second title line
|
||||||
|
@param[out] titleline3 third title line
|
||||||
|
@return an error code
|
||||||
|
*/
|
||||||
|
int DLLEXPORT EN_gettitle(EN_Project ph, char *titleline1, char *titleline2, char *titleline3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Sets the title lines of the project
|
||||||
|
@param titleline1 first title line
|
||||||
|
@param titleline2 second title line
|
||||||
|
@param titleline3 third title line
|
||||||
|
@return an error code
|
||||||
|
*/
|
||||||
|
int DLLEXPORT EN_settitle(EN_Project ph, char *titleline1, char *titleline2, char *titleline3);
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
|
|
||||||
Analysis Options Functions
|
Analysis Options Functions
|
||||||
|
|||||||
31
src/epanet.c
31
src/epanet.c
@@ -991,6 +991,37 @@ int DLLEXPORT EN_getstatistic(EN_Project p, int type, double *value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT EN_gettitle(EN_Project p, char *titleline1, char *titleline2, char *titleline3)
|
||||||
|
/*----------------------------------------------------------------
|
||||||
|
** Input: None
|
||||||
|
** Output: titleline1-3 = project's title lines
|
||||||
|
** Returns: error code
|
||||||
|
** Purpose: retrieves the title lines of the project
|
||||||
|
**----------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
if (!p->Openflag) return 102;
|
||||||
|
strcpy(titleline1, p->Title[0]);
|
||||||
|
strcpy(titleline2, p->Title[1]);
|
||||||
|
strcpy(titleline3, p->Title[2]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT EN_settitle(EN_Project p, char *titleline1, char *titleline2, char *titleline3)
|
||||||
|
/*----------------------------------------------------------------
|
||||||
|
** Input: titleline1-3 = project's title lines
|
||||||
|
** Returns: error code
|
||||||
|
** Purpose: sets the title lines of the project
|
||||||
|
**----------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
if (!p->Openflag) return 102;
|
||||||
|
strncpy(p->Title[0], titleline1, TITLELEN);
|
||||||
|
strncpy(p->Title[1], titleline2, TITLELEN);
|
||||||
|
strncpy(p->Title[2], titleline3, TITLELEN);
|
||||||
|
return 123;
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
|
|
||||||
Analysis Options Functions
|
Analysis Options Functions
|
||||||
|
|||||||
@@ -203,6 +203,16 @@ int DLLEXPORT ENgetstatistic(int type, EN_API_FLOAT_TYPE *value)
|
|||||||
return errcode;
|
return errcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENgettitle(char *titleline1, char *titleline2, char *titleline3)
|
||||||
|
{
|
||||||
|
return EN_gettitle(_defaultProject, titleline1, titleline2, titleline3) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT ENsettitle(char *titleline1, char *titleline2, char *titleline3)
|
||||||
|
{
|
||||||
|
return EN_settitle(_defaultProject, titleline1, titleline2, titleline3) ;
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
|
|
||||||
Analysis Options Functions
|
Analysis Options Functions
|
||||||
|
|||||||
@@ -112,3 +112,5 @@ EXPORTS
|
|||||||
ENstepQ = _ENstepQ@4
|
ENstepQ = _ENstepQ@4
|
||||||
ENusehydfile = _ENusehydfile@4
|
ENusehydfile = _ENusehydfile@4
|
||||||
ENwriteline = _ENwriteline@4
|
ENwriteline = _ENwriteline@4
|
||||||
|
ENgettitle = _ENgettitle@12
|
||||||
|
ENsettitle = _ENsettitle@12
|
||||||
Reference in New Issue
Block a user