SAGA API  v9.6
tool_library.cpp
Go to the documentation of this file.
1 
3 // //
4 // SAGA //
5 // //
6 // System for Automated Geoscientific Analyses //
7 // //
8 // Application Programming Interface //
9 // //
10 // Library: SAGA_API //
11 // //
12 //-------------------------------------------------------//
13 // //
14 // tool_library.cpp //
15 // //
16 // Copyright (C) 2006 by Olaf Conrad //
17 // //
18 //-------------------------------------------------------//
19 // //
20 // This file is part of 'SAGA - System for Automated //
21 // Geoscientific Analyses'. //
22 // //
23 // This library is free software; you can redistribute //
24 // it and/or modify it under the terms of the GNU Lesser //
25 // General Public License as published by the Free //
26 // Software Foundation, either version 2.1 of the //
27 // License, or (at your option) any later version. //
28 // //
29 // This library is distributed in the hope that it will //
30 // be useful, but WITHOUT ANY WARRANTY; without even the //
31 // implied warranty of MERCHANTABILITY or FITNESS FOR A //
32 // PARTICULAR PURPOSE. See the GNU Lesser General Public //
33 // License for more details. //
34 // //
35 // You should have received a copy of the GNU Lesser //
36 // General Public License along with this program; if //
37 // not, see <http://www.gnu.org/licenses/>. //
38 // //
39 //-------------------------------------------------------//
40 // //
41 // contact: Olaf Conrad //
42 // Institute of Geography //
43 // University of Goettingen //
44 // Goldschmidtstr. 5 //
45 // 37077 Goettingen //
46 // Germany //
47 // //
48 // e-mail: oconrad@saga-gis.org //
49 // //
51 
52 //---------------------------------------------------------
53 #include <wx/dynlib.h>
54 #include <wx/dir.h>
55 #include <wx/filename.h>
56 #include <wx/utils.h>
57 
58 #include "tool_chain.h"
59 
60 
62 // //
63 // //
64 // //
66 
67 //---------------------------------------------------------
69 {
70  m_pInterface = NULL;
71  m_pLibrary = NULL;
72 }
73 
74 //---------------------------------------------------------
76 {
77  m_pLibrary = new wxDynamicLibrary(SG_File_Get_Path_Absolute(File).c_str(), wxDL_DEFAULT|wxDL_QUIET);
78 
79  if( m_pLibrary->IsLoaded()
80  && m_pLibrary->HasSymbol(SYMBOL_TLB_Get_Interface)
81  && m_pLibrary->HasSymbol(SYMBOL_TLB_Initialize)
82  && m_pLibrary->HasSymbol(SYMBOL_TLB_Finalize)
83  && ((TSG_PFNC_TLB_Initialize)m_pLibrary->GetSymbol(SYMBOL_TLB_Initialize))(File) )
84  {
85  m_pInterface = ((TSG_PFNC_TLB_Get_Interface)m_pLibrary->GetSymbol(SYMBOL_TLB_Get_Interface))();
86 
87  if( m_pInterface->Get_Count() > 0 )
88  {
89  m_File_Name = m_pInterface->Get_Info(TLB_INFO_File );
90  m_Library_Name = m_pInterface->Get_Info(TLB_INFO_Library);
91 
92  return; // success
93  }
94  }
95 
96  _Destroy();
97 }
98 
99 //---------------------------------------------------------
101 {
102  _Destroy();
103 }
104 
105 //---------------------------------------------------------
106 bool CSG_Tool_Library::_Destroy(void)
107 {
108  if( m_pLibrary )
109  {
110  if( m_pLibrary->IsLoaded() && m_pLibrary->HasSymbol(SYMBOL_TLB_Finalize) )
111  {
112  TSG_PFNC_TLB_Finalize TLB_Finalize = (TSG_PFNC_TLB_Finalize)m_pLibrary->GetSymbol(SYMBOL_TLB_Finalize);
113 
114  TLB_Finalize();
115  }
116 
117  delete(m_pLibrary);
118 
119  m_pLibrary = NULL;
120  }
121 
122  m_pInterface = NULL;
123 
124  return( true );
125 }
126 
127 
129 // //
131 
132 //---------------------------------------------------------
134 {
135  if( m_pInterface != NULL )
136  {
137  return( m_pInterface->Get_Info(Type) );
138  }
139 
140  return( "" );
141 }
142 
143 
145 // //
147 
148 //---------------------------------------------------------
150 {
151  CSG_Tool *pTool = m_pInterface && Index >= 0 && Index < Get_Count() ? m_pInterface->Get_Tool(Index) : NULL;
152 
153  return( pTool && (Type == TOOL_TYPE_Base || Type == pTool->Get_Type()) ? pTool : NULL );
154 }
155 
156 //---------------------------------------------------------
157 CSG_Tool * CSG_Tool_Library::Get_Tool(const char *Name, TSG_Tool_Type Type) const { return( Get_Tool(CSG_String(Name), Type) ); }
158 CSG_Tool * CSG_Tool_Library::Get_Tool(const wchar_t *Name, TSG_Tool_Type Type) const { return( Get_Tool(CSG_String(Name), Type) ); }
160 {
161  for(int i=0; i<Get_Count(); i++)
162  {
163  CSG_Tool *pTool = Get_Tool(i, Type);
164 
165  if( pTool && (!pTool->Get_ID().Cmp(Name) || !pTool->Get_Name().Cmp(Name)) )
166  {
167  return( pTool );
168  }
169  }
170 
171  return( NULL );
172 }
173 
174 
176 // //
178 
179 //---------------------------------------------------------
189 //---------------------------------------------------------
190 CSG_Tool * CSG_Tool_Library::Create_Tool(int Index, bool bWithGUI, bool bWithCMD)
191 {
192  return( m_pInterface ? m_pInterface->Create_Tool(Index, bWithGUI, bWithCMD) : NULL );
193 }
194 
195 //---------------------------------------------------------
196 CSG_Tool * CSG_Tool_Library::Create_Tool(const char *Name, bool bWithGUI, bool bWithCMD) { return( Create_Tool(CSG_String(Name), bWithGUI, bWithCMD) ); }
197 CSG_Tool * CSG_Tool_Library::Create_Tool(const wchar_t *Name, bool bWithGUI, bool bWithCMD) { return( Create_Tool(CSG_String(Name), bWithGUI, bWithCMD) ); }
198 CSG_Tool * CSG_Tool_Library::Create_Tool(const CSG_String &Name, bool bWithGUI, bool bWithCMD)
199 {
200  int Index; return( Name.asInt(Index) ? Create_Tool(Index, bWithGUI, bWithCMD) : NULL );
201 }
202 
203 //---------------------------------------------------------
208 //---------------------------------------------------------
210 {
211  return( m_pInterface ? m_pInterface->Delete_Tool(pTool) : false );
212 }
213 
214 //---------------------------------------------------------
216 {
217  return( m_pInterface ? m_pInterface->Delete_Tools() : false );
218 }
219 
220 
222 // //
224 
225 //---------------------------------------------------------
227 {
228  if( Get_Tool(i) )
229  {
230  return( Get_Tool(i)->Get_MenuPath(true) );
231  }
232 
233  return( "" );
234 }
235 
236 
238 // //
240 
241 //---------------------------------------------------------
242 void CSG_Tool_Library::Add_Reference(const CSG_String &Authors, const CSG_String &Year, const CSG_String &Title, const CSG_String &Where, const SG_Char *Link, const SG_Char *Link_Text)
243 {
244  CSG_String Reference = Authors;
245 
246  Reference.Printf("<b>%s (%s):</b> %s. %s", Authors.c_str(), Year.c_str(), Title.c_str(), Where.c_str());
247 
248  if( Link && *Link )
249  {
250  Reference += CSG_String::Format(" <a href=\"%s\">%s</a>.", Link, Link_Text && *Link_Text ? Link_Text : Link);
251  }
252 
253  if( !Reference.is_Empty() )
254  {
255  m_References += Reference;
256  }
257 
258  m_References.Sort();
259 }
260 
261 //---------------------------------------------------------
262 void CSG_Tool_Library::Add_Reference(const CSG_String &Link, const SG_Char *Link_Text)
263 {
264  m_References += CSG_String::Format("<a href=\"%s\">%s</a>", Link.c_str(), Link_Text && *Link_Text ? Link_Text : Link.c_str());
265 
266  m_References.Sort();
267 }
268 
269 //---------------------------------------------------------
271 {
272  m_References.Clear();
273 }
274 
275 
277 // //
278 // //
279 // //
281 
282 //---------------------------------------------------------
284 
285 //---------------------------------------------------------
287 {
288  return( g_Tool_Library_Manager );
289 }
290 
291 
293 // //
295 
296 //---------------------------------------------------------
298 {
299  m_pLibraries = NULL;
300  m_nLibraries = 0;
301 
302  if( this == &g_Tool_Library_Manager )
303  {
304  CSG_Random::Initialize(); // initialize with current time on startup
305  }
306 }
307 
308 //---------------------------------------------------------
310 {
311  Destroy();
312 }
313 
314 
316 // //
318 
319 //---------------------------------------------------------
321 {
322  int nTools = 0;
323 
324  for(int i=0; i<m_nLibraries; i++)
325  {
326  nTools += m_pLibraries[i]->Get_Count();
327  }
328 
329  return( nTools );
330 }
331 
332 
334 // //
336 
337 //---------------------------------------------------------
339 {
340  if( bVerbose == false )
341  {
342  SG_UI_Msg_Lock(true);
343  }
344 
345  //-----------------------------------------------------
346  #if defined(_SAGA_MSW)
347  {
349  }
350  #elif defined(__WXMAC__)
351  {
352  if( SG_Get_Tool_Library_Manager().Add_Directory(SG_UI_Get_Application_Path(true) + "/../Tools", false) < 1 )
353  {
354  #ifdef TOOLS_PATH
356  #endif
357 
358  #ifdef SHARE_PATH
359  SG_Get_Tool_Library_Manager().Add_Directory(SG_File_Make_Path(SHARE_PATH, "toolchains")); // look for tool chains
360  #endif
361  }
362  }
363  #else // #if defined(_SAGA_LINUX)
364  {
365  #ifdef TOOLS_PATH
367  #endif
368 
369  #ifdef SHARE_PATH
370  SG_Get_Tool_Library_Manager().Add_Directory(SG_File_Make_Path(SHARE_PATH, "toolchains")); // look for tool chains
371  #endif
372  }
373  #endif
374 
375  //-----------------------------------------------------
376  CSG_String Paths;
377 
378  if( SG_Get_Environment("SAGA_TLB", &Paths) )
379  {
380  #if defined(_SAGA_MSW)
381  CSG_Strings Path = SG_String_Tokenize(Paths, ";" ); // colon (':') would split drive from paths!
382  #else // #if defined(_SAGA_LINUX) || defined(__WXMAC__)
383  CSG_Strings Path = SG_String_Tokenize(Paths, ";:"); // colon (':') is more native to non-windows os than semi-colon (';'), we support both...
384  #endif
385 
386  for(int i=0; i<Path.Get_Count(); i++)
387  {
389  }
390  }
391 
392  //-----------------------------------------------------
393  if( bVerbose == false )
394  {
395  SG_UI_Msg_Lock(false);
396  }
397 
398  return( Get_Count() > 0 );
399 }
400 
401 
403 // //
405 
406 //---------------------------------------------------------
410 {
411  if( SG_File_Exists(File) == false )
412  {
413  return( NULL );
414  }
415 
416  if( SG_File_Cmp_Extension(File, "xml") )
417  {
418  return( _Add_Tool_Chain(File) );
419  }
420 
421  if( SG_File_Cmp_Extension(File, "dll" ) == false
422  && SG_File_Cmp_Extension(File, "dylib") == false
423  && SG_File_Cmp_Extension(File, "so" ) == false )
424  {
425  return( NULL );
426  }
427 
428  //-----------------------------------------------------
429  wxFileName FileName(File.c_str());
430 
431  SG_UI_Msg_Add(CSG_String::Format("%s: %s...", _TL("Loading library"), File.c_str()), true);
432 
433  for(int i=0; i<Get_Count(); i++)
434  {
435  if( FileName == Get_Library(i)->Get_File_Name().c_str() )
436  {
437  SG_UI_Msg_Add(_TL("has already been loaded"), false);
438 
439  return( Get_Library(i) );
440  }
441  }
442 
443  //-----------------------------------------------------
444  CSG_Tool_Library *pLibrary = new CSG_Tool_Library(File);
445 
446  if( pLibrary->is_Valid() )
447  {
448  m_pLibraries = (CSG_Tool_Library **)SG_Realloc(m_pLibraries, (m_nLibraries + 1) * sizeof(CSG_Tool_Library *));
449  m_pLibraries[m_nLibraries++] = pLibrary;
450 
451  SG_UI_Msg_Add(_TL("okay"), false, SG_UI_MSG_STYLE_SUCCESS);
452 
453  return( pLibrary );
454  }
455 
456  delete(pLibrary);
457 
458  SG_UI_Msg_Add(_TL("failed"), false, SG_UI_MSG_STYLE_FAILURE);
459 
460  return( NULL );
461 }
462 
463 //---------------------------------------------------------
464 int CSG_Tool_Library_Manager::Add_Directory(const char *Directory, bool bOnlySubDirectories) { return( Add_Directory(CSG_String(Directory), bOnlySubDirectories) ); }
465 int CSG_Tool_Library_Manager::Add_Directory(const wchar_t *Directory, bool bOnlySubDirectories) { return( Add_Directory(CSG_String(Directory), bOnlySubDirectories) ); }
466 int CSG_Tool_Library_Manager::Add_Directory(const CSG_String &Directory, bool bOnlySubDirectories)
467 {
468  int nOpened = 0; wxDir Dir;
469 
470  if( Dir.Open(Directory.c_str()) )
471  {
472  wxString FileName, DirName(Dir.GetName());
473 
474  if( !bOnlySubDirectories && Dir.GetFirst(&FileName, wxEmptyString, wxDIR_FILES) )
475  {
476  do
477  { if( FileName.Find("saga_") < 0 && FileName.Find("wx") < 0 )
478  if( Add_Library(SG_File_Make_Path(&DirName, &FileName)) )
479  {
480  nOpened++;
481  }
482  }
483  while( Dir.GetNext(&FileName) );
484  }
485 
486  if( Dir.GetFirst(&FileName, wxEmptyString, wxDIR_DIRS) )
487  {
488  do
489  {
490  if( FileName.CmpNoCase("dll") )
491  {
492  nOpened += Add_Directory(SG_File_Make_Path(&DirName, &FileName), false);
493  }
494  }
495  while( Dir.GetNext(&FileName) );
496  }
497  }
498 
499  return( nOpened );
500 }
501 
502 
504 // //
506 
507 //---------------------------------------------------------
508 CSG_Tool_Library * CSG_Tool_Library_Manager::_Add_Tool_Chain(const CSG_String &File, bool bReload)
509 {
510  if( !SG_File_Cmp_Extension(File, "xml") )
511  {
512  return( NULL );
513  }
514 
515  //-----------------------------------------------------
516  CSG_Tool_Chains *pLibrary = NULL;
517  CSG_Tool_Chain *pTool = NULL;
518 
519  //-----------------------------------------------------
520  wxFileName FileName(File.c_str()); // check if tool chain is already loaded ?
521 
522  for(int iLibrary=0; !pTool && iLibrary<Get_Count(); iLibrary++)
523  {
524  if( Get_Library(iLibrary)->Get_Type() == ESG_Library_Type::Chain )
525  {
526  for(int iTool=0; !pTool && iTool<Get_Library(iLibrary)->Get_Count(); iTool++)
527  {
528  if( FileName == ((CSG_Tool_Chain *)Get_Library(iLibrary)->Get_Tool(iTool))->Get_File_Name().c_str() )
529  {
530  pLibrary = (CSG_Tool_Chains *)Get_Library(iLibrary);
531  pTool = (CSG_Tool_Chain *)Get_Library(iLibrary)->Get_Tool(iTool);
532  }
533  }
534  }
535  }
536 
537  if( pTool )
538  {
539  if( bReload ) // ...then try to reload !
540  {
542  CSG_Tool_Chain Tool(File); // don't reset loaded tool in case reloading fails!!!
544 
545  if( Tool.is_Okay() )
546  {
547  pTool->Create(File);
548  }
549  }
550 
551  return( pLibrary );
552  }
553 
554  //-----------------------------------------------------
555  pTool = new CSG_Tool_Chain(File);
556 
557  if( !pTool || !pTool->is_Okay() )
558  {
559  if( pTool )
560  {
561  delete(pTool);
562  }
563 
564  return( NULL );
565  }
566 
567  //-----------------------------------------------------
568  CSG_String Library = pTool->Get_Library();
569 
570  for(int iLibrary=0; !pLibrary && iLibrary<Get_Count(); iLibrary++)
571  {
572  if( Get_Library(iLibrary)->Get_Type() == ESG_Library_Type::Chain
573  && Get_Library(iLibrary)->Get_Library_Name().Cmp(Library) == 0 )
574  {
575  pLibrary = (CSG_Tool_Chains *)Get_Library(iLibrary);
576  }
577  }
578 
579  if( !pLibrary && (pLibrary = new CSG_Tool_Chains(pTool->Get_Library(), SG_File_Get_Path(File))) != NULL )
580  {
581  m_pLibraries = (CSG_Tool_Library **)SG_Realloc(m_pLibraries, (m_nLibraries + 1) * sizeof(CSG_Tool_Library *));
582  m_pLibraries[m_nLibraries++] = pLibrary;
583  }
584 
585  if( !pLibrary ) // this should never happen, but who knows...
586  {
587  SG_UI_Msg_Add_Error(CSG_String::Format("%s %s: %s", _TL("ERROR"), _TL("tool chain library"), File.c_str()));
588 
589  delete(pTool);
590 
591  return( NULL );
592  }
593 
594  pLibrary->Add_Tool(pTool);
595 
596  //-----------------------------------------------------
597  return( pLibrary );
598 }
599 
600 
602 // //
604 
605 //---------------------------------------------------------
607 {
608  if( m_pLibraries )
609  {
610  for(int i=0; i<Get_Count(); i++)
611  {
612 // #ifndef _SAGA_MSW
613  if( !SG_UI_Get_Window_Main() && m_pLibraries[i]->m_pLibrary )
614  {
615  m_pLibraries[i]->m_pLibrary->Detach();
616  }
617 // #endif
618 
619  delete(m_pLibraries[i]);
620  }
621 
622  SG_Free(m_pLibraries);
623 
624  m_pLibraries = NULL;
625  m_nLibraries = 0;
626  }
627 
628  return( true );
629 }
630 
631 
633 // //
635 
636 //---------------------------------------------------------
638 {
639  for(int i=0; i<Get_Count(); i++)
640  {
641  if( pLibrary == Get_Library(i) )
642  {
643  return( Del_Library(i) );
644  }
645  }
646 
647  return( false );
648 }
649 
650 //---------------------------------------------------------
652 {
653  if( i >= 0 && i < Get_Count() )
654  {
655  delete(m_pLibraries[i]);
656 
657  for(m_nLibraries--; i<m_nLibraries; i++)
658  {
659  m_pLibraries[i] = m_pLibraries[i + 1];
660  }
661 
662  m_pLibraries = (CSG_Tool_Library **)SG_Realloc(m_pLibraries, m_nLibraries * sizeof(CSG_Tool_Library *));
663 
664  return( true );
665  }
666 
667  return( false );
668 }
669 
670 //---------------------------------------------------------
672 {
673  for(int i=0; i<Get_Count(); i++)
674  {
675  if( pLibrary == Get_Library(i) )
676  {
677  return( true );
678  }
679  }
680 
681  return( false );
682 }
683 
684 
686 // //
688 
689 //---------------------------------------------------------
690 CSG_Tool_Library * CSG_Tool_Library_Manager::Get_Library(const char *Name, bool bLibrary, ESG_Library_Type Type) const { return( Get_Library(CSG_String(Name), bLibrary, Type) ); }
691 CSG_Tool_Library * CSG_Tool_Library_Manager::Get_Library(const wchar_t *Name, bool bLibrary, ESG_Library_Type Type) const { return( Get_Library(CSG_String(Name), bLibrary, Type) ); }
693 {
694  if( bLibrary )
695  {
696  SG_Get_Tool_Library_Manager()._Add_Library(Name);
697  }
698 
699  for(int i=0; i<Get_Count(); i++)
700  {
701  CSG_Tool_Library *pLibrary = Get_Library(i);
702 
703  if( Type == ESG_Library_Type::Undefined || Type == pLibrary->Get_Type() )
704  {
705  if( !Name.Cmp(bLibrary ? pLibrary->Get_Library_Name() : pLibrary->Get_Name()) )
706  {
707  return( pLibrary );
708  }
709  }
710  }
711 
712  return( NULL );
713 }
714 
715 //---------------------------------------------------------
716 bool CSG_Tool_Library_Manager::_Add_Library(const CSG_String &Library)
717 {
718  int bOkay = false;
719 
721 
722  //-----------------------------------------------------
723  #if defined(_SAGA_MSW)
724  if( Add_Library ( CSG_String::Format("%s\\tools\\%s.dll" , SG_UI_Get_API_Path().c_str() , Library.c_str())) ) { bOkay = true; }
725  if( _Add_Library_Chains(Library, CSG_String::Format("%s\\tools\\toolchains" , SG_UI_Get_API_Path().c_str() )) ) { bOkay = true; }
726  #elif defined(__WXMAC__)
727  if( Add_Library ( CSG_String::Format("%s/../Tools/lib%s.dylib", SG_UI_Get_Application_Path(true).c_str(), Library.c_str())) ) { bOkay = true; }
728  if( _Add_Library_Chains(Library, CSG_String::Format("%s/../Tools" , SG_UI_Get_Application_Path(true).c_str() )) ) { bOkay = true; }
729  #ifdef TOOLS_PATH
730  if( Add_Library ( CSG_String::Format("%s/lib%s.dylib" , CSG_String(TOOLS_PATH).c_str() , Library.c_str())) ) { bOkay = true; }
731  #endif
732  #ifdef SHARE_PATH
733  if( _Add_Library_Chains(Library, CSG_String::Format("%s/toolchains" , CSG_String(SHARE_PATH).c_str() )) ) { bOkay = true; }
734  #endif
735  #else // #if defined(_SAGA_LINUX)
736  #ifdef TOOLS_PATH
737  if( Add_Library ( CSG_String::Format("%s/lib%s.so" , CSG_String(TOOLS_PATH).c_str() , Library.c_str())) ) { bOkay = true; }
738  #endif
739  #ifdef SHARE_PATH
740  if( _Add_Library_Chains(Library, CSG_String::Format("%s/toolchains" , CSG_String(SHARE_PATH).c_str() )) ) { bOkay = true; }
741  #endif
742  #endif
743 
744  //-----------------------------------------------------
745  CSG_String Paths;
746 
747  if( SG_Get_Environment("SAGA_TLB", &Paths) )
748  {
749  #if defined(_SAGA_MSW)
750  const char *Format("%s\\%s.dll" ); CSG_Strings Path = SG_String_Tokenize(Paths, ";" ); // colon (':') would split drive from paths!
751  #elif defined(__WXMAC__)
752  const char *Format("%s/lib%s.dylib"); CSG_Strings Path = SG_String_Tokenize(Paths, ";:"); // colon (':') is more native to non-windows os than semi-colon (';'), we support both...
753  #else // #if defined(_SAGA_LINUX)
754  const char *Format("%s/lib%s.so" ); CSG_Strings Path = SG_String_Tokenize(Paths, ";:"); // colon (':') is more native to non-windows os than semi-colon (';'), we support both...
755  #endif
756 
757  for(int i=0; i<Path.Get_Count(); i++)
758  {
759  if( Add_Library (CSG_String::Format(Format, Path[i].c_str(), Library.c_str())) ) { bOkay = true; }
760  if( _Add_Library_Chains(Library , Path[i]) ) { bOkay = true; }
761  }
762  }
763 
764  //-----------------------------------------------------
766 
767  return( bOkay );
768 }
769 
770 //---------------------------------------------------------
771 bool CSG_Tool_Library_Manager::_Add_Library_Chains(const CSG_String &Library, const CSG_String &Directory)
772 {
773  wxDir dir; wxString file; bool bOkay = false;
774 
775  if( dir.Open(Directory.c_str()) && dir.GetFirst(&file, wxEmptyString, wxDIR_FILES) )
776  {
777  do
778  {
779  CSG_String path(SG_File_Make_Path(Directory, &file)); CSG_Tool_Chain Tool(path);
780 
781  if( Tool.is_Okay() && Tool.Get_Library().Cmp(Library) == 0 && _Add_Tool_Chain(path, false) )
782  {
783  bOkay = true;
784  }
785  }
786  while( dir.GetNext(&file) );
787  }
788 
789  return( bOkay );
790 }
791 
792 
794 // //
796 
797 //---------------------------------------------------------
798 CSG_Tool * CSG_Tool_Library_Manager::Get_Tool(const char *Library, int ID) const { return( Get_Tool(CSG_String(Library), ID) ); }
799 CSG_Tool * CSG_Tool_Library_Manager::Get_Tool(const wchar_t *Library, int ID) const { return( Get_Tool(CSG_String(Library), ID) ); }
801 {
802  return( Get_Tool(Library, CSG_String::Format("%d", ID)) );
803 }
804 
805 //---------------------------------------------------------
806 CSG_Tool * CSG_Tool_Library_Manager::Get_Tool(const char *Library, const char *Name) const { return( Get_Tool(CSG_String(Library), CSG_String(Name)) ); }
807 CSG_Tool * CSG_Tool_Library_Manager::Get_Tool(const wchar_t *Library, const wchar_t *Name) const { return( Get_Tool(CSG_String(Library), CSG_String(Name)) ); }
809 {
810  SG_Get_Tool_Library_Manager()._Add_Library(Library);
811 
812  for(int i=0; i<Get_Count(); i++)
813  {
814  if( Get_Library(i)->Get_Library_Name().Cmp(Library) == 0 )
815  {
816  CSG_Tool *pTool = Get_Library(i)->Get_Tool(Name);
817 
818  if( pTool )
819  {
820  return( pTool );
821  }
822  }
823  }
824 
825  return( NULL );
826 }
827 
828 
830 // //
832 
833 //---------------------------------------------------------
834 CSG_Tool * CSG_Tool_Library_Manager::Create_Tool(const char *Library, int Index, bool bWithGUI, bool bWithCMD) const { return( Create_Tool(CSG_String(Library), Index, bWithGUI, bWithCMD) ); }
835 CSG_Tool * CSG_Tool_Library_Manager::Create_Tool(const wchar_t *Library, int Index, bool bWithGUI, bool bWithCMD) const { return( Create_Tool(CSG_String(Library), Index, bWithGUI, bWithCMD) ); }
836 CSG_Tool * CSG_Tool_Library_Manager::Create_Tool(const CSG_String &Library, int Index, bool bWithGUI, bool bWithCMD) const
837 {
838  return( Create_Tool(Library, CSG_String::Format("%d", Index), bWithGUI, bWithCMD) );
839 }
840 
841 //---------------------------------------------------------
842 CSG_Tool * CSG_Tool_Library_Manager::Create_Tool(const char *Library, const char *Name, bool bWithGUI, bool bWithCMD) const { return( Create_Tool(CSG_String(Library), CSG_String(Name), bWithGUI, bWithCMD) ); }
843 CSG_Tool * CSG_Tool_Library_Manager::Create_Tool(const wchar_t *Library, const wchar_t *Name, bool bWithGUI, bool bWithCMD) const { return( Create_Tool(CSG_String(Library), CSG_String(Name), bWithGUI, bWithCMD) ); }
844 CSG_Tool * CSG_Tool_Library_Manager::Create_Tool(const CSG_String &Library, const CSG_String &Name, bool bWithGUI, bool bWithCMD) const
845 {
846  SG_Get_Tool_Library_Manager()._Add_Library(Library);
847 
848  for(int i=0; i<Get_Count(); i++)
849  {
850  if( Get_Library(i)->Get_Library_Name().Cmp(Library) == 0 )
851  {
852  CSG_Tool *pTool = Get_Library(i)->Create_Tool(Name, bWithGUI, bWithCMD);
853 
854  if( pTool )
855  {
856  return( pTool );
857  }
858  }
859  }
860 
861  return( NULL );
862 }
863 
864 //---------------------------------------------------------
866 {
867  for(int i=0; i<Get_Count(); i++)
868  {
869  if( Get_Library(i)->Delete_Tool(pTool) )
870  {
871  return( true );
872  }
873  }
874 
875  return( false );
876 }
877 
878 
880 // //
882 
883 //---------------------------------------------------------
884 bool CSG_Tool_Library_Manager::Create_Python_ToolBox(const CSG_String &Destination, bool bClean, bool bName, bool bSingleFile) const
885 {
886  const char *Header =
887  "#! /usr/bin/env python\n\n"
888  "'''\n"
889  "Python Interface to SAGA Tools Library\n"
890  "----------\n"
891  "- Category : %s\n"
892  "- Name : %s\n"
893  "- ID : %s\n\n"
894  "Description\n"
895  "----------\n%s\n"
896  "'''\n\n"
897  "from PySAGA.helper import Tool_Wrapper\n\n";
898 
899  CSG_File Stream;
900 
901  if( bSingleFile )
902  {
903  if( SG_File_Exists(Destination) )
904  {
905  SG_File_Delete(Destination);
906  }
907 
908  if( !Stream.Open(Destination, SG_FILE_W, false, SG_FILE_ENCODING_UTF8) )
909  {
910  SG_UI_Msg_Add_Error(CSG_String::Format("%s: %s", _TL("failed to create destination file"), Destination.c_str()));
911 
912  return( false );
913  }
914 
915  Stream.Write("#! /usr/bin/env python\n\n'''\n");
916  Stream.Write("Python Interface to SAGA Tools\n");
917  Stream.Write("----------\n'''\n\n");
918  Stream.Write("from PySAGA.helper import Tool_Wrapper\n\n");
919  }
920  else
921  {
922  if( !SG_Dir_Exists(Destination) && !SG_Dir_Create(Destination, true) )
923  {
924  SG_UI_Msg_Add_Error(CSG_String::Format("%s: %s", _TL("failed to create destination folder"), Destination.c_str()));
925 
926  return( false );
927  }
928 
929  if( bClean )
930  {
931  CSG_Strings Files;
932 
933  SG_Dir_List_Files(Files, Destination);
934 
935  for(int i=0; i<Files.Get_Count(); i++)
936  {
937  SG_File_Delete(Files[i]);
938  }
939  }
940  }
941 
942  SG_UI_Set_Application_Name("python");
943 
944  //-----------------------------------------------------
945  // skip tool chains in 1st run...
946  for(int iLibrary=0; iLibrary<Get_Count() && SG_UI_Process_Set_Progress(iLibrary, Get_Count()); iLibrary++)
947  {
948  CSG_Tool_Library *pLibrary = Get_Library(iLibrary);
949 
950  if( !pLibrary->Get_Category ().Cmp("SAGA Development" ) // generally exclude certain categories/libraries
951  || !pLibrary->Get_Category ().Cmp("Garden" )
952  || !pLibrary->Get_Library_Name().Cmp("grid_calculus_bsl")
953  || !pLibrary->Get_Library_Name().Cmp("pj_geotrans" )
954  || !pLibrary->Get_Library_Name().Cmp("vis_3d_viewer" )
955  || pLibrary->Get_Type() == ESG_Library_Type::Chain ) // exclude tool chains in 1st run
956  {
957  continue;
958  }
959 
960  SG_UI_Process_Set_Text(CSG_String::Format("%s: %s", SG_T("Library"), pLibrary->Get_Library_Name().c_str()));
961 
962  if( !bSingleFile )
963  {
964  if( !Stream.Open(SG_File_Make_Path(Destination, pLibrary->Get_Library_Name(), "py"), SG_FILE_W, false, SG_FILE_ENCODING_UTF8) )
965  {
966  continue;
967  }
968 
969  Stream.Printf(Header, pLibrary->Get_Category().c_str(), pLibrary->Get_Name().c_str(), pLibrary->Get_Library_Name().c_str(), SG_HTML_Tag_Replacer(pLibrary->Get_Description()).c_str());
970  }
971 
972  for(int iTool=0; iTool<pLibrary->Get_Count(); iTool++)
973  {
974  CSG_Tool *pTool = pLibrary->Create_Tool(pLibrary->Get_Tool(iTool)->Get_ID(), false, false);
975 
976  if( pTool && !pTool->needs_GUI() && !pTool->is_Interactive() && pTool->Get_Parameters_Count() == 0 )
977  {
978  if( bName )
979  {
980  Stream.Write(pTool->Get_Script(TOOL_SCRIPT_PYTHON_WRAP_NAME, false));
981  }
982 
983  Stream.Write(pTool->Get_Script(TOOL_SCRIPT_PYTHON_WRAP_ID, false));
984  }
985 
986  pLibrary->Delete_Tool(pTool);
987  }
988  }
989 
990  //-----------------------------------------------------
991  // add tool chains in 2nd run...
992  for(int iLibrary=0; iLibrary<Get_Count() && SG_UI_Process_Set_Progress(iLibrary, Get_Count()); iLibrary++)
993  {
994  CSG_Tool_Library *pLibrary = Get_Library(iLibrary);
995 
996  if( !pLibrary->Get_Category().Cmp("SAGA Development" ) // generally exclude certain categories
997  || !pLibrary->Get_Category().Cmp("Garden" )
998  || pLibrary->Get_Type() != ESG_Library_Type::Chain ) // only process tool chains in 2nd run
999  {
1000  continue;
1001  }
1002 
1003  SG_UI_Process_Set_Text(CSG_String::Format("%s: %s", SG_T("Library"), pLibrary->Get_Library_Name().c_str()));
1004 
1005  if( !bSingleFile )
1006  {
1007  CSG_String File(SG_File_Make_Path(Destination, pLibrary->Get_Library_Name(), "py"));
1008 
1009  if( SG_File_Exists(File) )
1010  {
1011  if( !Stream.Open(File, SG_FILE_RW, false, SG_FILE_ENCODING_UTF8) )
1012  {
1013  continue;
1014  }
1015 
1016  Stream.Seek_End();
1017  }
1018  else
1019  {
1020  if( !Stream.Open(File, SG_FILE_W, false, SG_FILE_ENCODING_UTF8) )
1021  {
1022  continue;
1023  }
1024 
1025  Stream.Printf(Header, pLibrary->Get_Category().c_str(), pLibrary->Get_Name().c_str(), pLibrary->Get_Library_Name().c_str(), SG_HTML_Tag_Replacer(pLibrary->Get_Description()).c_str());
1026  }
1027  }
1028 
1029  for(int iTool=0; iTool<pLibrary->Get_Count(); iTool++)
1030  {
1031  CSG_Tool *pTool = pLibrary->Create_Tool(pLibrary->Get_Tool(iTool)->Get_ID(), false, false);
1032 
1033  if( pTool && !pTool->needs_GUI() && !pTool->is_Interactive() && pTool->Get_Parameters_Count() == 0 )
1034  {
1035  if( bName )
1036  {
1037  Stream.Write(pTool->Get_Script(TOOL_SCRIPT_PYTHON_WRAP_NAME, false));
1038  }
1039 
1040  Stream.Write(pTool->Get_Script(TOOL_SCRIPT_PYTHON_WRAP_ID, false));
1041  }
1042 
1043  pLibrary->Delete_Tool(pTool);
1044  }
1045  }
1046 
1047  //-----------------------------------------------------
1048  SG_UI_Set_Application_Name(); // reset
1049 
1050  return( true );
1051 }
1052 
1053 
1055 // //
1056 // //
1057 // //
1059 
1060 //---------------------------------------------------------
CSG_Tool_Library_Interface::Get_Tool
CSG_Tool * Get_Tool(int i)
Definition: tool_library_interface.cpp:180
CSG_Tool_Chains
Definition: tool_chain.h:174
CSG_File::Open
virtual bool Open(const CSG_String &FileName, int Mode=SG_FILE_R, bool bBinary=true, int Encoding=SG_FILE_ENCODING_ANSI)
Definition: api_file.cpp:111
CSG_Tool_Chains::Add_Tool
bool Add_Tool(CSG_Tool_Chain *pTool)
CSG_Tool_Library_Manager::~CSG_Tool_Library_Manager
virtual ~CSG_Tool_Library_Manager(void)
Definition: tool_library.cpp:309
SG_File_Get_Path
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Path(const CSG_String &full_Path)
Definition: api_file.cpp:891
SG_T
#define SG_T(s)
Definition: api_core.h:537
CSG_String::Printf
int Printf(const char *Format,...)
Definition: api_string.cpp:308
_TL
#define _TL(s)
Definition: api_core.h:1489
CSG_Tool_Library_Manager::Destroy
bool Destroy(void)
Definition: tool_library.cpp:606
CSG_Tool_Library_Manager::Get_Tool
CSG_Tool * Get_Tool(const CSG_String &Library, int Index) const
Definition: tool_library.cpp:800
SG_HTML_Tag_Replacer
SAGA_API_DLL_EXPORT CSG_String SG_HTML_Tag_Replacer(const CSG_String &Text)
Definition: api_string.cpp:1389
TLB_INFO_Library
@ TLB_INFO_Library
Definition: tool.h:630
CSG_Tool_Library_Manager::Add_Library
CSG_Tool_Library * Add_Library(const CSG_String &File)
Definition: tool_library.cpp:409
SG_Dir_Exists
SAGA_API_DLL_EXPORT bool SG_Dir_Exists(const CSG_String &Directory)
Definition: api_file.cpp:743
CSG_Tool_Library
Definition: tool_library.h:105
CSG_Tool_Library::CSG_Tool_Library
CSG_Tool_Library(void)
Definition: tool_library.cpp:68
SG_UI_MSG_STYLE_SUCCESS
@ SG_UI_MSG_STYLE_SUCCESS
Definition: api_core.h:1505
CSG_String::asInt
int asInt(void) const
Definition: api_string.cpp:722
SG_File_Cmp_Extension
SAGA_API_DLL_EXPORT bool SG_File_Cmp_Extension(const CSG_String &FileName, const CSG_String &Extension)
Definition: api_file.cpp:952
CSG_Tool::needs_GUI
virtual bool needs_GUI(void) const
Definition: tool.h:234
tool_chain.h
CSG_Tool_Library::Get_Name
CSG_String Get_Name(void) const
Definition: tool_library.h:118
CSG_Tool
Definition: tool.h:151
CSG_Tool_Library::Del_References
void Del_References(void)
Definition: tool_library.cpp:270
CSG_Tool_Library::Create_Tool
virtual CSG_Tool * Create_Tool(int Index, bool bWithGUI=false, bool bWithCMD=true)
Definition: tool_library.cpp:190
CSG_Tool_Library_Interface::Create_Tool
CSG_Tool * Create_Tool(int i, bool bWithGUI=false, bool bWithCMD=true)
Definition: tool_library_interface.cpp:196
CSG_Tool_Library_Manager::Del_Library
bool Del_Library(int i)
Definition: tool_library.cpp:651
CSG_Tool::Get_Name
const CSG_String & Get_Name(void) const
Definition: tool.cpp:132
SG_File_Delete
SAGA_API_DLL_EXPORT bool SG_File_Delete(const CSG_String &FileName)
Definition: api_file.cpp:856
CSG_Tool_Library::Get_Type
virtual ESG_Library_Type Get_Type(void) const
Definition: tool_library.h:110
SG_Free
SAGA_API_DLL_EXPORT void SG_Free(void *memblock)
Definition: api_memory.cpp:83
TSG_Tool_Type
TSG_Tool_Type
Definition: tool.h:101
CSG_Tool_Library::~CSG_Tool_Library
virtual ~CSG_Tool_Library(void)
Definition: tool_library.cpp:100
CSG_Tool_Library_Manager::Delete_Tool
bool Delete_Tool(CSG_Tool *pTool) const
Definition: tool_library.cpp:865
CSG_File
Definition: api_core.h:1124
CSG_String::Cmp
int Cmp(const CSG_String &String) const
Definition: api_string.cpp:515
CSG_Tool::Get_Parameters_Count
int Get_Parameters_Count(void) const
Definition: tool.h:183
SYMBOL_TLB_Initialize
#define SYMBOL_TLB_Initialize
Definition: tool.h:671
TSG_PFNC_TLB_Get_Interface
CSG_Tool_Library_Interface *(* TSG_PFNC_TLB_Get_Interface)(void)
Definition: tool.h:678
SG_Get_Environment
SAGA_API_DLL_EXPORT bool SG_Get_Environment(const CSG_String &Variable, CSG_String *Value=NULL)
Definition: api_file.cpp:992
SG_UI_MSG_STYLE_FAILURE
@ SG_UI_MSG_STYLE_FAILURE
Definition: api_core.h:1506
SG_FILE_RW
@ SG_FILE_RW
Definition: api_core.h:1111
CSG_Random::Initialize
static void Initialize(void)
Definition: mat_tools.cpp:260
CSG_Tool_Library::Delete_Tools
virtual bool Delete_Tools(void)
Definition: tool_library.cpp:215
SG_File_Exists
SAGA_API_DLL_EXPORT bool SG_File_Exists(const CSG_String &FileName)
Definition: api_file.cpp:850
CSG_Strings::Clear
void Clear(void)
Definition: api_core.h:734
CSG_Tool_Library_Interface::Delete_Tool
bool Delete_Tool(CSG_Tool *pTool)
Definition: tool_library_interface.cpp:218
CSG_Tool_Library_Manager::is_Loaded
bool is_Loaded(CSG_Tool_Library *pLibrary) const
Definition: tool_library.cpp:671
CSG_Tool_Library::Get_File_Name
const CSG_String & Get_File_Name(void) const
Definition: tool_library.h:114
CSG_Tool_Library_Manager::Get_Count
int Get_Count(void) const
Definition: tool_library.h:191
SG_Dir_Create
SAGA_API_DLL_EXPORT bool SG_Dir_Create(const CSG_String &Directory, bool bFullPath=false)
Definition: api_file.cpp:749
TLB_INFO_File
@ TLB_INFO_File
Definition: tool.h:629
CSG_Tool_Library::Get_Count
virtual int Get_Count(void) const
Definition: tool_library.h:128
SYMBOL_TLB_Get_Interface
#define SYMBOL_TLB_Get_Interface
Definition: tool.h:677
SG_UI_Msg_Lock
int SG_UI_Msg_Lock(bool bOn)
Definition: api_callback.cpp:471
CSG_Tool_Library::Delete_Tool
virtual bool Delete_Tool(CSG_Tool *pTool)
Definition: tool_library.cpp:209
CSG_Tool::Get_Library
const CSG_String & Get_Library(void) const
Definition: tool.cpp:115
CSG_Tool_Library::Get_Description
CSG_String Get_Description(void) const
Definition: tool_library.h:119
SG_Get_Tool_Library_Manager
CSG_Tool_Library_Manager & SG_Get_Tool_Library_Manager(void)
Definition: tool_library.cpp:286
CSG_Tool_Library::Get_Library_Name
const CSG_String & Get_Library_Name(void) const
Definition: tool_library.h:115
CSG_Tool::Get_Script
CSG_String Get_Script(TSG_Tool_Script_Type Type, bool bHeader=true, bool bAllParameters=false)
Definition: tool.cpp:1322
TSG_PFNC_TLB_Finalize
bool(* TSG_PFNC_TLB_Finalize)(void)
Definition: tool.h:675
g_Tool_Library_Manager
CSG_Tool_Library_Manager g_Tool_Library_Manager
Definition: tool_library.cpp:283
SG_UI_Process_Set_Text
void SG_UI_Process_Set_Text(const CSG_String &Text)
Definition: api_callback.cpp:323
SG_UI_Set_Application_Name
CSG_String SG_UI_Set_Application_Name(const CSG_String &Name)
Definition: api_core.cpp:388
SG_String_Tokenize
SAGA_API_DLL_EXPORT CSG_Strings SG_String_Tokenize(const CSG_String &String, const CSG_String &Delimiters=SG_DEFAULT_DELIMITERS, TSG_String_Tokenizer_Mode Mode=SG_TOKEN_DEFAULT)
Definition: api_string.cpp:1540
CSG_Tool_Library::m_Library_Name
CSG_String m_Library_Name
Definition: tool_library.h:159
CSG_Tool_Library_Interface::Get_Count
int Get_Count(void)
Definition: tool_library_interface.cpp:174
CSG_Tool_Chain::Create
bool Create(const CSG_Tool_Chain &Tool, bool bWithGUI, bool bWithCMD)
Definition: tool_chain.cpp:133
CSG_Tool::Get_ID
const CSG_String & Get_ID(void) const
Definition: tool.h:166
CSG_Tool_Library::Get_Info
virtual CSG_String Get_Info(int Type) const
Definition: tool_library.cpp:133
CSG_Tool_Library::Add_Reference
void Add_Reference(const CSG_String &Authors, const CSG_String &Year, const CSG_String &Title, const CSG_String &Where, const SG_Char *Link=NULL, const SG_Char *Link_Text=NULL)
Definition: tool_library.cpp:242
CSG_Tool_Library::Get_Menu
CSG_String Get_Menu(void) const
Definition: tool_library.h:122
SG_FILE_W
@ SG_FILE_W
Definition: api_core.h:1110
CSG_Strings
Definition: api_core.h:699
CSG_Tool_Library_Manager::CSG_Tool_Library_Manager
CSG_Tool_Library_Manager(void)
Definition: tool_library.cpp:297
CSG_Tool_Library_Interface::Delete_Tools
bool Delete_Tools(void)
Definition: tool_library_interface.cpp:234
SG_Dir_List_Files
SAGA_API_DLL_EXPORT bool SG_Dir_List_Files(CSG_Strings &List, const CSG_String &Directory)
Definition: api_file.cpp:811
CSG_String::Format
static CSG_String Format(const char *Format,...)
Definition: api_string.cpp:270
CSG_Tool_Chain
Definition: tool_chain.h:78
CSG_Tool_Library_Manager::Create_Tool
CSG_Tool * Create_Tool(const CSG_String &Library, int Index, bool bWithGUI=false, bool bWithCMD=true) const
Definition: tool_library.cpp:836
ESG_Library_Type::Library
@ Library
CSG_Tool_Library_Manager::Create_Python_ToolBox
bool Create_Python_ToolBox(const CSG_String &Destination, bool bClean=true, bool bName=true, bool bSingleFile=false) const
Definition: tool_library.cpp:884
TOOL_SCRIPT_PYTHON_WRAP_NAME
@ TOOL_SCRIPT_PYTHON_WRAP_NAME
Definition: tool.h:126
SG_File_Get_Path_Absolute
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Path_Absolute(const CSG_String &full_Path)
Definition: api_file.cpp:899
SG_Char
#define SG_Char
Definition: api_core.h:536
TSG_PFNC_TLB_Initialize
bool(* TSG_PFNC_TLB_Initialize)(const SG_Char *)
Definition: tool.h:672
CSG_String
Definition: api_core.h:563
SG_UI_Get_Application_Path
CSG_String SG_UI_Get_Application_Path(bool bPathOnly)
Definition: api_core.cpp:356
SYMBOL_TLB_Finalize
#define SYMBOL_TLB_Finalize
Definition: tool.h:674
CSG_Tool_Library_Interface::Get_Info
const CSG_String & Get_Info(int ID)
Definition: tool_library_interface.cpp:163
CSG_Tool_Library::Get_Tool
virtual CSG_Tool * Get_Tool(int Index, TSG_Tool_Type Type=TOOL_TYPE_Base) const
Definition: tool_library.cpp:149
CSG_Strings::Sort
bool Sort(bool Ascending=true)
Definition: api_string.cpp:1121
CSG_Tool_Chain::is_Okay
bool is_Okay(void) const
Definition: tool_chain.h:96
CSG_Tool_Library::is_Valid
bool is_Valid(void) const
Definition: tool_library.h:112
CSG_File::Printf
int Printf(const char *Format,...)
Definition: api_file.cpp:277
CSG_String::is_Empty
bool is_Empty(void) const
Definition: api_string.cpp:178
SG_UI_Process_Set_Progress
bool SG_UI_Process_Set_Progress(int Position, int Range)
Definition: api_callback.cpp:255
CSG_Tool_Library_Manager::Add_Default_Libraries
bool Add_Default_Libraries(bool bVerbose=false)
Definition: tool_library.cpp:338
TOOL_TYPE_Base
@ TOOL_TYPE_Base
Definition: tool.h:102
CSG_Tool::is_Interactive
virtual bool is_Interactive(void) const
Definition: tool.h:239
TOOL_SCRIPT_PYTHON_WRAP_ID
@ TOOL_SCRIPT_PYTHON_WRAP_ID
Definition: tool.h:129
CSG_Tool_Library_Manager::Add_Directory
int Add_Directory(const CSG_String &Directory, bool bOnlySubDirectories=false)
Definition: tool_library.cpp:466
ESG_Library_Type
ESG_Library_Type
Definition: tool_library.h:92
CSG_Tool_Library_Manager::Get_Tool_Count
int Get_Tool_Count(void) const
Definition: tool_library.cpp:320
SG_UI_Get_API_Path
CSG_String SG_UI_Get_API_Path(void)
Definition: api_core.cpp:345
SG_UI_Get_Window_Main
void * SG_UI_Get_Window_Main(void)
Definition: api_callback.cpp:796
CSG_Tool_Library_Manager::Get_Library
CSG_Tool_Library * Get_Library(int i) const
Definition: tool_library.h:207
SG_File_Make_Path
SAGA_API_DLL_EXPORT CSG_String SG_File_Make_Path(const CSG_String &Directory, const CSG_String &Name)
Definition: api_file.cpp:919
SG_UI_ProgressAndMsg_Lock
void SG_UI_ProgressAndMsg_Lock(bool bOn)
Definition: api_callback.cpp:589
CSG_String::c_str
const SG_Char * c_str(void) const
Definition: api_string.cpp:236
CSG_File::Write
size_t Write(void *Buffer, size_t Size, size_t Count=1) const
Definition: api_file.cpp:360
CSG_Strings::Get_Count
int Get_Count(void) const
Definition: api_core.h:712
SG_Realloc
SAGA_API_DLL_EXPORT void * SG_Realloc(void *memblock, size_t size)
Definition: api_memory.cpp:77
SG_UI_Msg_Add_Error
void SG_UI_Msg_Add_Error(const char *Message)
Definition: api_callback.cpp:556
CSG_Tool::Get_Type
virtual TSG_Tool_Type Get_Type(void) const
Definition: tool.h:164
SG_FILE_ENCODING_UTF8
@ SG_FILE_ENCODING_UTF8
Definition: api_core.h:552
CSG_Tool_Library::Get_Category
CSG_String Get_Category(void) const
Definition: tool_library.h:123
CSG_Tool_Library::m_File_Name
CSG_String m_File_Name
Definition: tool_library.h:159
CSG_File::Seek_End
bool Seek_End(void) const
Definition: api_file.cpp:258
CSG_Tool_Library_Manager
Definition: tool_library.h:184
SG_UI_Msg_Add
void SG_UI_Msg_Add(const char *Message, bool bNewLine, TSG_UI_MSG_STYLE Style)
Definition: api_callback.cpp:502