diff --git a/include/epanet2.bas b/include/epanet2.bas index 2955f9b..09e9e4c 100644 --- a/include/epanet2.bas +++ b/include/epanet2.bas @@ -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 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 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 Declare Function ENgetoption Lib "epanet2.dll" (ByVal option_ As Long, value As Single) As Long diff --git a/include/epanet2.h b/include/epanet2.h index 03558e5..55bde59 100644 --- a/include/epanet2.h +++ b/include/epanet2.h @@ -144,6 +144,10 @@ extern "C" { int DLLEXPORT ENgeterror(int errcode, char *errmsg, int maxLen); 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); /******************************************************************** diff --git a/include/epanet2.vb b/include/epanet2.vb index 3ada541..6fee91b 100644 --- a/include/epanet2.vb +++ b/include/epanet2.vb @@ -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 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 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 Declare Function ENgetoption Lib "epanet2.dll" (ByVal option As Int32, value As Single) As Int32 diff --git a/include/epanet2_2.h b/include/epanet2_2.h index baa657b..fbf9c15 100644 --- a/include/epanet2_2.h +++ b/include/epanet2_2.h @@ -580,6 +580,24 @@ typedef struct Project *EN_Project; */ 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 diff --git a/src/epanet.c b/src/epanet.c index 7735578..a8b424c 100644 --- a/src/epanet.c +++ b/src/epanet.c @@ -991,6 +991,37 @@ int DLLEXPORT EN_getstatistic(EN_Project p, int type, double *value) 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 diff --git a/src/epanet2.c b/src/epanet2.c index 8c02b3a..faa1718 100644 --- a/src/epanet2.c +++ b/src/epanet2.c @@ -203,6 +203,16 @@ int DLLEXPORT ENgetstatistic(int type, EN_API_FLOAT_TYPE *value) 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 diff --git a/win_build/WinSDK/epanet2.def b/win_build/WinSDK/epanet2.def index 19b76e5..29c71eb 100644 --- a/win_build/WinSDK/epanet2.def +++ b/win_build/WinSDK/epanet2.def @@ -112,3 +112,5 @@ EXPORTS ENstepQ = _ENstepQ@4 ENusehydfile = _ENusehydfile@4 ENwriteline = _ENwriteline@4 + ENgettitle = _ENgettitle@12 + ENsettitle = _ENsettitle@12 \ No newline at end of file