dart-sdk/runtime/bin/platform.h
ager@google.com 758943e32a Add read-only environment variable access.
Map<String, String> env = new Platform().environment();

Unfortunately, this is a bit hard to test at this point. I
will move on to implement support for providing an environment
to processes that are started. At that point we can test it
properly.

Another follow-up change will be to remove the instantiation
for Platform. I would like this to be just

Map<String, String> env = Platform.environment();

R=sgjesse@google.com
BUG=dartbug.com/752
TEST=

Review URL: https://chromiumcodereview.appspot.com//10112002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6646 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-17 16:20:28 +00:00

42 lines
1.3 KiB
C++

// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef BIN_PLATFORM_H_
#define BIN_PLATFORM_H_
#include "bin/builtin.h"
class Platform {
public:
// Perform platform specific initialization.
static bool Initialize();
// Returns the number of processors on the machine.
static int NumberOfProcessors();
// Returns a string representing the operating system ("linux",
// "macos" or "windows"). The returned string should not be
// deallocated by the caller.
static const char* OperatingSystem();
// Returns a string representation of an error code. The returned
// string must be deallocated by the caller.
static char* StrError(int error_code);
// Extracts the local hostname.
static bool LocalHostname(char* buffer, intptr_t buffer_length);
// Extracts the environment variables for the current process.
// The array of strings returned must be deallocated using
// delete[]. The number of elements in the array is returned
// in the count argument.
static char** Environment(intptr_t* count);
private:
DISALLOW_ALLOCATION();
DISALLOW_IMPLICIT_CONSTRUCTORS(Platform);
};
#endif // BIN_PLATFORM_H_