/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsCRT_h___
#define nsCRT_h___
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "plstr.h"
#include "nscore.h"
#include "prtypes.h"
#include "nsCppSharedAllocator.h"
#ifdef XP_MAC
#else
# else
# endif /* XP_UNIX */
# endif /* XP_WIN || XP_OS2 */
#endif /* XP_MAC */
// This macro can be used in a class declaration for classes that want
// to ensure that their instance memory is zeroed.
#define NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW \
if (rv) { \
} \
return rv; \
} \
}
// This macro works with the next macro to declare a non-inlined
// version of the above.
#define NS_DECL_ZEROING_OPERATOR_NEW \
if (rv) { \
} \
return rv; \
} \
}
// Freeing helper
/// This is a wrapper class around all the C runtime functions.
enum {
};
/***
*** The following nsCRT::mem* functions are no longer
*** supported, please use the corresponding lib C
*** functions instead.
***
*** nsCRT::memcpy()
*** nsCRT::memcmp()
*** nsCRT::memmove()
*** nsCRT::memset()
*** nsCRT::zero()
***
*** Additionally, the following char* string utilities
*** are no longer supported, please use the
*** corresponding lib C functions instead.
***
*** nsCRT::strlen()
***
***/
/** Compute the string length of s
@param s the string in question
@return the length of s
*/
}
/// Compare s1 and s2.
}
}
/// Case-insensitive string comparison.
}
/// Case-insensitive string comparison with length
//Egads. PL_strncasecmp is returning *very* negative numbers.
//Some folks expect -1,0,1, so let's temper its enthusiasm.
if (result<0)
result=-1;
return result;
}
// inline the first test (assumes strings are not null):
}
}
}
}
/**
How to use this fancy (thread-safe) version of strtok:
void main(void) {
printf("%s\n\nTokens:\n", string);
// Establish string and get the first token:
char* newStr;
token = nsCRT::strtok(string, seps, &newStr);
while (token != NULL) {
// While there are tokens in "string"
printf(" %s\n", token);
// Get next token:
token = nsCRT::strtok(newStr, seps, &newStr);
}
}
* WARNING - STRTOK WHACKS str THE FIRST TIME IT IS CALLED *
* MAKE A COPY OF str IF YOU NEED TO USE IT AFTER strtok() *
*/
/// Like strlen except for ucs2 strings
/// Like strcmp except for ucs2 strings
/// Like strcmp except for ucs2 strings
// You must use nsCRT::free(PRUnichar*) to free memory allocated
// by nsCRT::strdup(PRUnichar*).
// You must use nsCRT::free(PRUnichar*) to free memory allocated
// by strndup(PRUnichar*, PRUint32).
}
// Computes the hashcode for a c-string, returns the string length as
// an added bonus.
// Computes the hashcode for a ucs2 string, returns the string length
// as an added bonus.
// Computes a hashcode for a ucs2 string that returns the same thing
// as the HashCode method taking a |char*| would if the string were
// converted to UTF8. Returns the string length as an added bonus.
// Computes the hashcode for a buffer with a specified length.
// Computes the hashcode for a buffer with a specified length.
// String to longlong
};
#if defined(XP_MAC)
#else
#endif
#else
#endif
#endif /* nsCRT_h___ */