LCOV - code coverage report
Current view: directory - xpcom/io - nsLocalFile.h (source / functions) Found Hit Coverage
Test: app.info Lines: 10 5 50.0 %
Date: 2012-06-02 Functions: 1 1 100.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Mozilla Communicator client code, released
      16                 :  * March 31, 1998.
      17                 :  *
      18                 :  * The Initial Developer of the Original Code is
      19                 :  * Netscape Communications Corporation.
      20                 :  * Portions created by the Initial Developer are Copyright (C) 1998-1999
      21                 :  * the Initial Developer. All Rights Reserved.
      22                 :  *
      23                 :  * Contributor(s):
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK *****
      38                 :  *
      39                 :  * This Original Code has been modified by IBM Corporation. Modifications made by IBM 
      40                 :  * described herein are Copyright (c) International Business Machines Corporation, 2000.
      41                 :  * Modifications to Mozilla code or documentation identified per MPL Section 3.3
      42                 :  *
      43                 :  * Date             Modified by     Description of modification
      44                 :  * 04/20/2000       IBM Corp.      OS/2 build.
      45                 :  */
      46                 : 
      47                 : #ifndef _NS_LOCAL_FILE_H_
      48                 : #define _NS_LOCAL_FILE_H_
      49                 : 
      50                 : #include "nscore.h"
      51                 : 
      52                 : #define NS_LOCAL_FILE_CID {0x2e23e220, 0x60be, 0x11d3, {0x8c, 0x4a, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
      53                 : 
      54                 : #define NS_DECL_NSLOCALFILE_UNICODE_METHODS                                                      \
      55                 :     nsresult AppendUnicode(const PRUnichar *aNode);                                              \
      56                 :     nsresult GetUnicodeLeafName(PRUnichar **aLeafName);                                          \
      57                 :     nsresult SetUnicodeLeafName(const PRUnichar *aLeafName);                                     \
      58                 :     nsresult CopyToUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName);               \
      59                 :     nsresult CopyToFollowingLinksUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName); \
      60                 :     nsresult MoveToUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName);               \
      61                 :     nsresult GetUnicodeTarget(PRUnichar **aTarget);                                              \
      62                 :     nsresult GetUnicodePath(PRUnichar **aPath);                                                  \
      63                 :     nsresult InitWithUnicodePath(const PRUnichar *aPath);                                        \
      64                 :     nsresult AppendRelativeUnicodePath(const PRUnichar *aRelativePath);
      65                 : 
      66                 : // nsXPComInit needs to know about how we are implemented,
      67                 : // so here we will export it.  Other users should not depend
      68                 : // on this.
      69                 : 
      70                 : #include <errno.h>
      71                 : #include "nsILocalFile.h"
      72                 : 
      73                 : #ifdef XP_WIN
      74                 : #include "nsLocalFileWin.h"
      75                 : #elif defined(XP_UNIX)
      76                 : #include "nsLocalFileUnix.h"
      77                 : #elif defined(XP_OS2)
      78                 : #include "nsLocalFileOS2.h"
      79                 : #else
      80                 : #error NOT_IMPLEMENTED
      81                 : #endif
      82                 : 
      83                 : #define NSRESULT_FOR_RETURN(ret) (((ret) < 0) ? NSRESULT_FOR_ERRNO() : NS_OK)
      84                 : 
      85                 : inline nsresult
      86           20205 : nsresultForErrno(int err)
      87                 : {
      88           20205 :     switch (err) {
      89                 :       case 0:
      90           11013 :         return NS_OK;
      91                 :       case ENOENT:
      92            7631 :         return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
      93                 :       case ENOTDIR:
      94               0 :         return NS_ERROR_FILE_DESTINATION_NOT_DIR;
      95                 : #ifdef ENOLINK
      96                 :       case ENOLINK:
      97               0 :         return NS_ERROR_FILE_UNRESOLVABLE_SYMLINK;
      98                 : #endif /* ENOLINK */
      99                 :       case EEXIST:
     100            1561 :         return NS_ERROR_FILE_ALREADY_EXISTS;
     101                 : #ifdef EPERM
     102                 :       case EPERM:
     103                 : #endif /* EPERM */
     104                 :       case EACCES:
     105               0 :         return NS_ERROR_FILE_ACCESS_DENIED;
     106                 :       /*
     107                 :        * On AIX 4.3, ENOTEMPTY is defined as EEXIST,
     108                 :        * so there can't be cases for both without
     109                 :        * preprocessing.
     110                 :        */
     111                 : #if ENOTEMPTY != EEXIST
     112                 :       case ENOTEMPTY:
     113               0 :         return NS_ERROR_FILE_DIR_NOT_EMPTY;
     114                 : #endif /* ENOTEMPTY != EEXIST */
     115                 :       default:
     116               0 :         return NS_ERROR_FAILURE;
     117                 :     }
     118                 : }
     119                 : 
     120                 : #define NSRESULT_FOR_ERRNO() nsresultForErrno(errno)
     121                 : 
     122                 : void NS_StartupLocalFile();
     123                 : void NS_ShutdownLocalFile();
     124                 : 
     125                 : #endif

Generated by: LCOV version 1.7