Open Files 5.3.0
Multi-Platform Event-Driven Application Framework
path.h
Go to the documentation of this file.
1 /* Copyright (c) 2021 Connected Way, LLC. All rights reserved.
2  * Use of this source code is governed by a Creative Commons
3  * Attribution-NoDerivatives 4.0 International license that can be
4  * found in the LICENSE file.
5  */
6 #if !defined(__OFC_PATH_H__)
7 #define __OFC_PATH_H__
8 
9 #include "ofc/core.h"
10 #include "ofc/types.h"
11 #include "ofc/config.h"
12 #include "ofc/file.h"
13 
123 
124 
125 #if defined(__cplusplus)
126 extern "C"
127 {
128 #endif
134 OFC_CORE_LIB OFC_VOID
141 OFC_CORE_LIB OFC_VOID
164 OFC_CORE_LIB OFC_BOOL
166  OFC_PATH *map, OFC_FST_TYPE fsType, OFC_BOOL thumbnail);
170 OFC_CORE_LIB OFC_BOOL
172  OFC_PATH *map, OFC_FST_TYPE fsType, OFC_BOOL thumbnail);
182 OFC_CORE_LIB OFC_PATH *
187 OFC_CORE_LIB OFC_PATH *
189 
190 OFC_CORE_LIB OFC_PATH *
206 OFC_CORE_LIB OFC_VOID
224 OFC_CORE_LIB OFC_SIZET
229 OFC_CORE_LIB OFC_SIZET
230 ofc_path_printA(OFC_PATH *path, OFC_LPSTR *filename, OFC_SIZET *rem);
244 
305 OFC_CORE_LIB OFC_SIZET
307  OFC_SIZET *rem,
308  OFC_LPCTSTR username,
309  OFC_LPCTSTR password,
310  OFC_LPCTSTR domain,
311  OFC_LPCTSTR server,
312  OFC_LPCTSTR share,
313  OFC_LPCTSTR path,
314  OFC_LPCTSTR file);
318 OFC_CORE_LIB OFC_SIZET
320  OFC_SIZET *rem,
321  OFC_LPCSTR username,
322  OFC_LPCSTR password,
323  OFC_LPCSTR domain,
324  OFC_LPCSTR server,
325  OFC_LPCSTR share,
326  OFC_LPCSTR path,
327  OFC_LPCSTR file);
334 OFC_CORE_LIB OFC_VOID
348 OFC_CORE_LIB OFC_VOID
349 ofc_path_mapW(OFC_LPCTSTR lpFileName, OFC_LPTSTR *lppMappedName,
350  OFC_FST_TYPE *filesystem);
354 OFC_CORE_LIB OFC_VOID
355 ofc_path_mapA(OFC_LPCSTR lpFileName, OFC_LPSTR *lppMappedName,
356  OFC_FST_TYPE *filesystem);
357 
358 #if 0
374 OFC_CORE_LIB OFC_VOID
375 ofc_root_path_mapW(OFC_LPCTSTR lpRootPath, OFC_LPTSTR *lppMappedPath,
376  OFC_FS_TYPE *filesystem) ;
377 OFC_CORE_LIB OFC_VOID
378 ofc_root_path_mapA(OFC_LPCSTR lpRootPath, OFC_LPSTR *lppMappedPath,
379  OFC_FS_TYPE *filesystem) ;
380 #endif
387 OFC_CORE_LIB OFC_VOID
392 OFC_CORE_LIB OFC_VOID
403 OFC_CORE_LIB OFC_PATH *
408 OFC_CORE_LIB OFC_PATH *
410 
414 #define AUTHENTICATE
415 #if defined(AUTHENTICATE)
416 OFC_CORE_LIB OFC_VOID
417 ofc_path_update_credentialsW(OFC_LPCTSTR filename, OFC_LPCTSTR username,
418  OFC_LPCTSTR password, OFC_LPCTSTR domain);
422 OFC_CORE_LIB OFC_VOID
423 ofc_path_update_credentialsA(OFC_LPCSTR filename, OFC_LPCSTR username,
424  OFC_LPCSTR password, OFC_LPCSTR domain);
425 
426 #else
427 OFC_CORE_LIB OFC_VOID
428 ofc_path_update_credentialsW(OFC_PATH *path, OFC_LPCTSTR username,
429  OFC_LPCTSTR password, OFC_LPCTSTR domain) ;
430 OFC_CORE_LIB OFC_VOID
431 ofc_path_update_credentialsA(OFC_PATH *path, OFC_LPCSTR username,
432  OFC_LPCSTR password, OFC_LPCSTR domain) ;
433 #endif
451 OFC_CORE_LIB OFC_VOID
452 ofc_path_get_rootW(OFC_CTCHAR *lpFileName, OFC_TCHAR **lpRootName,
453  OFC_FST_TYPE *filesystem);
457 OFC_CORE_LIB OFC_VOID
458 ofc_path_get_rootA(OFC_CCHAR *lpFileName, OFC_CHAR **lpRootName,
459  OFC_FST_TYPE *filesystem);
460 
464 OFC_CORE_LIB OFC_VOID
465 ofc_path_get_mapW(OFC_INT idx, OFC_LPCTSTR *lpDevice,
466  OFC_LPCTSTR *lpDesc, OFC_PATH **map,
467  OFC_BOOL *thumbnail);
468 
472 OFC_CORE_LIB OFC_PATH *ofc_map_path(OFC_LPCTSTR lpFileName,
473  OFC_LPTSTR *lppMappedName);
474 
478 OFC_CORE_LIB OFC_BOOL ofc_path_remote(OFC_PATH *path);
482 OFC_CORE_LIB OFC_BOOL ofc_path_hidden(OFC_PATH *path);
483 
487 OFC_CORE_LIB OFC_VOID ofc_path_free_server(OFC_PATH *path);
488 
492 OFC_CORE_LIB OFC_LPCTSTR ofc_path_server(OFC_PATH *path);
493 
497 OFC_CORE_LIB OFC_INT ofc_path_port(OFC_PATH *path);
498 
502 OFC_CORE_LIB OFC_VOID ofc_path_set_port(OFC_PATH *_path, OFC_INT port);
503 
507 OFC_CORE_LIB OFC_VOID ofc_path_set_device(OFC_PATH *_path, OFC_LPCTSTR device);
508 
512 OFC_CORE_LIB OFC_VOID
513 ofc_path_set_server(OFC_PATH *path, OFC_LPCTSTR server);
514 
518 OFC_CORE_LIB OFC_VOID
519 ofc_path_set_share(OFC_PATH *_path, OFC_LPCTSTR share);
520 
524 OFC_CORE_LIB OFC_VOID
525 ofc_path_set_filename(OFC_PATH *_path, OFC_LPCTSTR filename);
526 
530 OFC_CORE_LIB OFC_BOOL
531 ofc_path_server_cmp(OFC_PATH *path, OFC_LPCTSTR server);
532 
536 OFC_CORE_LIB OFC_BOOL
537 ofc_path_port_cmp(OFC_PATH *_path, OFC_UINT16 port);
538 
542 OFC_CORE_LIB OFC_LPCTSTR ofc_path_share(OFC_PATH *path);
543 
547 OFC_CORE_LIB OFC_BOOL
548 ofc_path_share_cmp(OFC_PATH *path, OFC_LPCTSTR share);
549 
553 OFC_CORE_LIB OFC_LPCTSTR ofc_path_username(OFC_PATH *path);
554 
558 OFC_CORE_LIB OFC_VOID ofc_path_set_username(OFC_PATH *_path,
559  OFC_LPCTSTR username);
560 
564 OFC_CORE_LIB OFC_BOOL
565 ofc_path_username_cmp(OFC_PATH *path, OFC_LPCTSTR username);
566 
570 OFC_CORE_LIB OFC_LPCTSTR ofc_path_password(OFC_PATH *path);
571 
575 OFC_CORE_LIB OFC_VOID ofc_path_set_password(OFC_PATH *_path,
576  OFC_LPCTSTR password);
577 
581 OFC_CORE_LIB OFC_BOOL
582 ofc_path_password_cmp(OFC_PATH *path, OFC_LPCTSTR password);
583 
587 OFC_CORE_LIB OFC_LPCTSTR ofc_path_domain(OFC_PATH *path);
588 
592 OFC_CORE_LIB OFC_VOID ofc_path_set_domain(OFC_PATH *_path,
593  OFC_LPCTSTR domain);
597 OFC_CORE_LIB OFC_BOOL
598 ofc_path_domain_cmp(OFC_PATH *_path, OFC_LPCTSTR domain);
599 
603 OFC_CORE_LIB OFC_LPCTSTR ofc_path_device(OFC_PATH *path);
604 
608 OFC_CORE_LIB OFC_VOID ofc_path_free_device(OFC_PATH *path);
609 
613 OFC_CORE_LIB OFC_VOID ofc_path_free_username(OFC_PATH *path);
614 
618 OFC_CORE_LIB OFC_VOID ofc_path_free_password(OFC_PATH *path);
619 
623 OFC_CORE_LIB OFC_VOID ofc_path_free_domain(OFC_PATH *path);
624 
628 OFC_CORE_LIB OFC_VOID
629 ofc_path_promote_dirs(OFC_PATH *path, OFC_UINT num_dirs);
630 
634 OFC_CORE_LIB OFC_VOID ofc_path_set_local(OFC_PATH *_path);
635 
639 OFC_CORE_LIB OFC_VOID ofc_path_set_remote(OFC_PATH *_path);
640 
644 OFC_CORE_LIB OFC_VOID ofc_path_set_relative(OFC_PATH *path);
645 
649 OFC_CORE_LIB OFC_VOID ofc_path_set_absolute(OFC_PATH *path);
650 
654 OFC_CORE_LIB OFC_BOOL ofc_path_absolute(OFC_PATH *path);
655 
659 OFC_CORE_LIB OFC_FST_TYPE ofc_path_type(OFC_PATH *path);
660 
664 OFC_CORE_LIB OFC_VOID
665 ofc_path_set_type(OFC_PATH *path, OFC_FST_TYPE fstype);
666 
670 OFC_CORE_LIB OFC_LPCTSTR ofc_path_filename(OFC_PATH *path);
671 
675 OFC_CORE_LIB OFC_VOID ofc_path_free_filename(OFC_PATH *path);
676 
680 OFC_CORE_LIB OFC_INT ofc_path_num_dirs(OFC_PATH *path);
681 
685 OFC_CORE_LIB OFC_LPCTSTR ofc_path_dir(OFC_PATH *path, OFC_UINT ix);
686 
690 OFC_CORE_LIB OFC_VOID ofc_path_free_dirs(OFC_PATH *path);
691 
695 OFC_CORE_LIB OFC_VOID ofc_path_insert_dir(OFC_PATH *path, OFC_UINT ix,
696  OFC_CTCHAR *dir);
697 
701 OFC_CORE_LIB OFC_VOID ofc_path_debug(OFC_PATH *path);
702 
706 OFC_CORE_LIB OFC_VOID init_workgroups(OFC_VOID);
707 
711 OFC_CORE_LIB OFC_VOID destroy_workgroups(OFC_VOID);
712 
716 OFC_CORE_LIB OFC_VOID update_workgroup(OFC_LPCTSTR workgroup);
717 
721 OFC_CORE_LIB OFC_VOID remove_workgroup(OFC_LPCTSTR workgroup);
722 
726 OFC_CORE_LIB OFC_BOOL lookup_workgroup(OFC_LPCTSTR workgroup);
727 
728 #if defined(__cplusplus)
729 }
730 #endif
731 
732 #if defined(OFC_UNICODE_API)
739 #define ofc_path_add_map ofc_path_add_mapW
746 #define ofc_path_create ofc_path_createW
753 #define ofc_path_print ofc_path_printW
760 #define ofc_path_make_url ofc_path_make_urlW
767 #define ofc_path_map ofc_path_mapW
774 #define ofc_path_delete_map ofc_path_delete_mapW
781 #define ofc_path_map_device ofc_path_map_deviceW
788 #define ofc_path_update_credentials ofc_path_update_credentialsW
789 #define ofc_path_get_root ofc_path_get_rootW
790 #else
795 #define ofc_path_add_map ofc_path_add_mapA
800 #define ofc_path_create ofc_path_createA
807 #define ofc_path_print ofc_path_printA
814 #define ofc_path_make_url ofc_path_make_urlA
821 #define ofc_path_map ofc_path_mapA
828 #define ofc_path_delete_map ofc_path_delete_mapA
835 #define ofc_path_map_device ofc_path_map_deviceA
842 #define ofc_path_update_credentials ofc_path_update_credentialsA
849 #define ofc_path_get_root ofc_path_get_rootA
850 #endif
851 
855 #endif
OFC_CORE_LIB OFC_SIZET ofc_path_make_urlA(OFC_LPSTR *filename, OFC_SIZET *rem, OFC_LPCSTR username, OFC_LPCSTR password, OFC_LPCSTR domain, OFC_LPCSTR server, OFC_LPCSTR share, OFC_LPCSTR path, OFC_LPCSTR file)
OFC_CORE_LIB OFC_VOID ofc_path_delete_mapW(OFC_LPCTSTR lpVirtual)
OFC_CORE_LIB OFC_VOID ofc_path_update(OFC_PATH *path, OFC_PATH *map)
OFC_CORE_LIB OFC_SIZET ofc_path_printW(OFC_PATH *path, OFC_LPTSTR *filename, OFC_SIZET *rem)
OFC_CORE_LIB OFC_SIZET ofc_path_make_urlW(OFC_LPTSTR *filename, OFC_SIZET *rem, OFC_LPCTSTR username, OFC_LPCTSTR password, OFC_LPCTSTR domain, OFC_LPCTSTR server, OFC_LPCTSTR share, OFC_LPCTSTR path, OFC_LPCTSTR file)
OFC_CORE_LIB OFC_VOID ofc_path_init(OFC_VOID)
OFC_CORE_LIB OFC_SIZET ofc_path_printA(OFC_PATH *path, OFC_LPSTR *filename, OFC_SIZET *rem)
OFC_CORE_LIB OFC_PATH * ofc_path_createW(OFC_LPCTSTR lpFileName)
OFC_CORE_LIB OFC_PATH * ofc_path_map_deviceW(OFC_LPCTSTR lpDevice)
OFC_CORE_LIB OFC_VOID ofc_path_delete_mapA(OFC_LPCSTR lpVirtual)
OFC_CORE_LIB OFC_BOOL ofc_path_add_mapW(OFC_LPCTSTR lpDevice, OFC_LPCTSTR lpDesc, OFC_PATH *map, OFC_FST_TYPE fsType, OFC_BOOL thumbnail)
OFC_CORE_LIB OFC_VOID ofc_path_mapA(OFC_LPCSTR lpFileName, OFC_LPSTR *lppMappedName, OFC_FST_TYPE *filesystem)
OFC_CORE_LIB OFC_VOID ofc_path_mapW(OFC_LPCTSTR lpFileName, OFC_LPTSTR *lppMappedName, OFC_FST_TYPE *filesystem)
OFC_CORE_LIB OFC_VOID ofc_path_destroy(OFC_VOID)
OFC_CORE_LIB OFC_PATH * ofc_path_map_deviceA(OFC_LPCSTR lpDevice)
OFC_CORE_LIB OFC_BOOL ofc_path_add_mapA(OFC_LPCSTR lpDevice, OFC_LPCSTR lpDesc, OFC_PATH *map, OFC_FST_TYPE fsType, OFC_BOOL thumbnail)
OFC_CORE_LIB OFC_VOID ofc_path_delete(OFC_PATH *path)
OFC_CORE_LIB OFC_PATH * ofc_path_init_path(OFC_VOID)
OFC_CORE_LIB OFC_PATH * ofc_path_createA(OFC_LPCSTR lpFileName)
OFC_BOOL ofc_path_is_wild(OFC_LPCTSTR dir)
OFC_VOID OFC_PATH
Definition: path.h:122
OFC_CORE_LIB OFC_TCHAR * ofc_path_print_alloc(OFC_PATH *path)
void OFC_VOID
Definition: types.h:159
OFC_CHAR * OFC_LPSTR
Definition: types.h:418
const OFC_CHAR OFC_CCHAR
Definition: types.h:414
const OFC_TCHAR * OFC_LPCTSTR
Definition: types.h:498
OFC_UINT8 OFC_BOOL
Definition: types.h:624
unsigned int OFC_UINT
Definition: types.h:123
OFC_TCHAR * OFC_LPTSTR
Definition: types.h:490
OFC_WCHAR OFC_TCHAR
Definition: types.h:463
char OFC_CHAR
Definition: types.h:143
const OFC_CHAR * OFC_LPCSTR
Definition: types.h:422
const OFC_WCHAR OFC_CTCHAR
Definition: types.h:467
int OFC_INT
Definition: types.h:119
long int OFC_SIZET
Definition: types.h:115
unsigned short int OFC_UINT16
Definition: types.h:183