Changeset 39

Show
Ignore:
Timestamp:
01/04/08 11:00:27 (11 months ago)
Author:
flithm
Message:

Fixes for Tango 0.99.4

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CMakeLists.txt

    r38 r39  
    1 ################################## 
     1################################# 
    22# Preamble 
    33############## 
  • trunk/tango/scrapple/net/http/HttpMultipart.d

    r36 r39  
    1919       tango.io.FilePath, 
    2020       tango.net.http.HttpPost, 
    21        tango.util.time.DateTime, 
     21       tango.time.Clock, 
     22       tango.time.Time, 
    2223        
    2324       ConvertTime = tango.text.convert.TimeStamp; 
     
    6162    { 
    6263        super(url); 
    63         boundary = getBoundary(ConvertTime.toUtf8(DateTime.now.time)); 
     64        boundary = getBoundary(ConvertTime.toString(Clock.now)); 
    6465    } 
    6566     
  • trunk/tango/scrapple/protocol/PlainTextProtocol.d

    r11 r39  
    9696    } 
    9797     
    98     /*************************************************************************** 
    99  
    100         Construct a buffer upon the given conduit, placing a buffer between 
    101  
    102     ***************************************************************************/ 
    103  
    104     this (IConduit conduit, bool _prefix = true) 
    105     { 
    106         this (new Buffer (conduit), _prefix); 
    107     } 
    108  
    10998    /*************************************************************************** 
    11099 
  • trunk/tango/scrapple/sys/win32/Registry.d

    r34 r39  
    6363private import tango.core.Exception; 
    6464private import tango.stdc.string : wcslen; 
    65 private import tango.text.convert.Utf : toUtf16, toUTF8 = toUtf8
     65private import tango.text.convert.Utf : toString16, toUTF8 = toString
    6666 
    6767// Grabbed from juno.base.native, use tango.sys.win32.UserGdi have some problem here 
     
    220220 
    221221// Grabbed from juno.base.string since Tango's stdc.stringz, text.convert.Utf lacks these: 
    222 public wchar* toUtf16z(string s, int start = 0, int count = -1) { 
     222public wchar* toString16z(string s, int start = 0, int count = -1) { 
    223223  if (s is null) 
    224224    return null; 
     
    229229  return s[start .. count].toUTF16z(); 
    230230} 
    231 public string toUtf8(wchar* s, int start = 0, int count = -1) { 
     231public string toString(wchar* s, int start = 0, int count = -1) { 
    232232  if (s == null) 
    233233    return null; 
     
    342342    { 
    343343        wchar[] ws; 
    344         ws = toUtf16(s); 
     344        ws = toString16(s); 
    345345        ws ~= '\0'; 
    346346        return ws.ptr; 
     
    356356    if (parts[i].length > 0) { 
    357357      string temp = "%" ~ parts[i] ~ "%"; 
    358       uint n = ExpandEnvironmentStrings(temp.toUtf16z(), buffer.ptr, c); 
     358      uint n = ExpandEnvironmentStrings(temp.toString16z(), buffer.ptr, c); 
    359359      while (n > c) { 
    360360        c = n; 
    361361        buffer.length = c; 
    362         n = ExpandEnvironmentStrings(temp.toUtf16z(), buffer.ptr, c); 
    363       } 
    364     } 
    365   } 
    366   int n = ExpandEnvironmentStrings(name.toUtf16z(), buffer.ptr, c); 
     362        n = ExpandEnvironmentStrings(temp.toString16z(), buffer.ptr, c); 
     363      } 
     364    } 
     365  } 
     366  int n = ExpandEnvironmentStrings(name.toString16z(), buffer.ptr, c); 
    367367  while (n > c) { 
    368368    c = n; 
    369369    buffer.length = c; 
    370     n = ExpandEnvironmentStrings(name.toUtf16z(), buffer.ptr, c); 
    371   } 
    372  
    373   return .toUtf8(buffer.ptr); 
     370    n = ExpandEnvironmentStrings(name.toString16z(), buffer.ptr, c); 
     371  } 
     372 
     373  return .toString(buffer.ptr); 
    374374} 
    375375 
     
    465465  public RegistryKey openSubKey(string name, bool writable = false) { 
    466466    Handle hkey; 
    467     int r = RegOpenKeyEx(hKey_, name.toUtf16z(), 0, (writable ? (KEY_READ | KEY_WRITE) : KEY_READ), hkey); 
     467    int r = RegOpenKeyEx(hKey_, name.toString16z(), 0, (writable ? (KEY_READ | KEY_WRITE) : KEY_READ), hkey); 
    468468    if (r == ERROR_SUCCESS && hkey != Handle.init && hkey != INVALID_HANDLE_VALUE) { 
    469469      auto key = new RegistryKey(hkey, writable, false, false, false); 
     
    479479    Handle hkey; 
    480480    uint disposition; 
    481     int r = RegCreateKeyEx(hKey_, name.toUtf16z(), 0, null, 0, KEY_READ | KEY_WRITE, null, hkey, disposition); 
     481    int r = RegCreateKeyEx(hKey_, name.toString16z(), 0, null, 0, KEY_READ | KEY_WRITE, null, hkey, disposition); 
    482482    if (r == ERROR_SUCCESS && hkey != Handle.init && hkey != INVALID_HANDLE_VALUE) { 
    483483      auto key = new RegistryKey(hkey, true, false, false, false); 
     
    498498   */ 
    499499  public void deleteSubKey(string name) { 
    500     RegDeleteKey(hKey_, name.toUtf16z()); 
     500    RegDeleteKey(hKey_, name.toString16z()); 
    501501  } 
    502502 
     
    511511      key.close(); 
    512512 
    513       int r = RegDeleteKey(hKey_, name.toUtf16z()); 
     513      int r = RegDeleteKey(hKey_, name.toString16z()); 
    514514      //if (r != ERROR_SUCCESS) 
    515515        //issueError(r, null); 
     
    524524   */ 
    525525  public void deleteValue(string name) { 
    526     RegDeleteValue(hKey_, name.toUtf16z()); 
     526    RegDeleteValue(hKey_, name.toString16z()); 
    527527  } 
    528528 
     
    534534  public RegistryValueKind getValueKind(string name) { 
    535535    uint cb, type; 
    536     RegQueryValueEx(hKey_, name.toUtf16z(), null, &type, null, &cb); 
     536    RegQueryValueEx(hKey_, name.toString16z(), null, &type, null, &cb); 
    537537    return cast(RegistryValueKind)type; 
    538538  } 
     
    548548  public T getValue(T)(string name, T defaultValue = T.init, bool doNotExpand = false) { 
    549549    uint cb, type; 
    550     if (RegQueryValueEx(hKey_, name.toUtf16z(), null, &type, null, &cb) == 0) { 
     550    if (RegQueryValueEx(hKey_, name.toString16z(), null, &type, null, &cb) == 0) { 
    551551      static if (is(T == int)) { 
    552552        if (type == REG_DWORD) { 
    553553          int b; 
    554           RegQueryValueEx(hKey_, name.toUtf16z(), null, &type, cast(ubyte*)&b, &cb); 
     554          RegQueryValueEx(hKey_, name.toString16z(), null, &type, cast(ubyte*)&b, &cb); 
    555555          return b; 
    556556        } 
     
    559559        if (type == REG_QWORD) { 
    560560          long b; 
    561           RegQueryValueEx(hKey_, name.toUtf16z(), null, &type, cast(ubyte*)&b, &cb); 
     561          RegQueryValueEx(hKey_, name.toString16z(), null, &type, cast(ubyte*)&b, &cb); 
    562562          return b; 
    563563        } 
     
    566566        if (type == REG_SZ || type == REG_EXPAND_SZ) { 
    567567          wchar[] b = new wchar[cb / 2]; 
    568           RegQueryValueEx(hKey_, name.toUtf16z(), null, &type, cast(ubyte*)b.ptr, &cb); 
    569           string result = .toUtf8(b.ptr); 
     568          RegQueryValueEx(hKey_, name.toString16z(), null, &type, cast(ubyte*)b.ptr, &cb); 
     569          string result = .toString(b.ptr); 
    570570 
    571571          if (!doNotExpand && type == REG_EXPAND_SZ) 
     
    580580 
    581581          wchar[] b = new wchar[cb / 2]; 
    582           RegQueryValueEx(hKey_, name.toUtf16z(), null, &type, cast(ubyte*)b.ptr, &cb); 
     582          RegQueryValueEx(hKey_, name.toString16z(), null, &type, cast(ubyte*)b.ptr, &cb); 
    583583 
    584584          uint index = 0; 
     
    589589 
    590590            if (pos < end) { 
    591               if (pos - index > 0) result ~= .toUtf8(b.ptr, index, pos); 
     591              if (pos - index > 0) result ~= .toString(b.ptr, index, pos); 
    592592              else if (pos != end - 1) result ~= ""; 
    593593            } 
    594             else result ~= .toUtf8(b.ptr, index, end); 
     594            else result ~= .toString(b.ptr, index, end); 
    595595 
    596596            index = pos + 1; 
     
    603603        if (type == REG_BINARY || type == REG_DWORD_BIG_ENDIAN) { 
    604604          ubyte[] b = new ubyte[cb]; 
    605           RegQueryValueEx(hKey_, name.toUtf16z(), null, &type, b.ptr, &cb); 
     605          RegQueryValueEx(hKey_, name.toString16z(), null, &type, b.ptr, &cb); 
    606606          return b; 
    607607        } 
     
    643643        else 
    644644          s = value; 
    645         r = RegSetValueEx(hKey_, name.toUtf16z(), 0, REG_SZ, cast(ubyte*)s.toUtf16z(), (s.length * 2) + 2); 
     645        r = RegSetValueEx(hKey_, name.toString16z(), 0, REG_SZ, cast(ubyte*)s.toString16z(), (s.length * 2) + 2); 
    646646        break; 
    647647      case RegistryValueKind.MultiString: 
    648648        break; 
    649649      case RegistryValueKind.Binary: 
    650         r = RegSetValueEx(hKey_, name.toUtf16z(), 0, REG_BINARY, cast(ubyte*)value.ptr, value.length); 
     650        r = RegSetValueEx(hKey_, name.toString16z(), 0, REG_BINARY, cast(ubyte*)value.ptr, value.length); 
    651651        break; 
    652652      case RegistryValueKind.DWord: 
    653         r = RegSetValueEx(hKey_, name.toUtf16z(), 0, REG_DWORD, cast(ubyte*)&value, int.sizeof); 
     653        r = RegSetValueEx(hKey_, name.toString16z(), 0, REG_DWORD, cast(ubyte*)&value, int.sizeof); 
    654654        break; 
    655655      case RegistryValueKind.QWord: 
    656         r = RegSetValueEx(hKey_, name.toUtf16z(), 0, REG_QWORD, cast(ubyte*)&value, long.sizeof); 
     656        r = RegSetValueEx(hKey_, name.toString16z(), 0, REG_QWORD, cast(ubyte*)&value, long.sizeof); 
    657657        break; 
    658658      default: 
     
    692692        uint cch = buffer.length; 
    693693        RegEnumKeyEx(hKey_, index, buffer.ptr, &cch, null, null, null, null); 
    694         result[index] = .toUtf8(buffer.ptr); 
     694        result[index] = .toString(buffer.ptr); 
    695695      } 
    696696    } 
     
    722722        uint cch = buffer.length; 
    723723        RegEnumValue(hKey_, index, buffer.ptr, &cch, null, null, null, null); 
    724         result[index] = .toUtf8(buffer.ptr); 
     724        result[index] = .toString(buffer.ptr); 
    725725      } 
    726726    } 
     
    749749      uint r = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_IGNORE_INSERTS, null, error, LOCALE_USER_DEFAULT, buffer.ptr, buffer.length + 1, null); 
    750750      if (r != 0) { 
    751         return toUtf8(buffer.ptr, 0, r); 
     751        return toString(buffer.ptr, 0, r); 
    752752      } 
    753753      return format("Unspecified error (0x{0:X8})", error); 
  • trunk/tango/scrapple/text/convert/TimeStamp.d

    r10 r39  
    1313module tango.scrapple.text.convert.TimeStamp; 
    1414 
    15 import tango.util.time.Date; 
     15import tango.time.Time; 
    1616 
    1717/******************************************************************************* 
  • trunk/tango/scrapple/util/Test.d

    r33 r39  
    6565private import tango.io.Stdout; 
    6666private import tango.text.Util; 
    67 private import tango.util.time.StopWatch; 
     67private import tango.time.StopWatch; 
    6868private import tango.core.Array; 
    6969private import Float = tango.text.convert.Float; 
     
    266266                        Stdout.format(" ({})", join(tc._messages[i], ", ")); 
    267267                    if (config.caseTime) 
    268                         Stdout.format(" [{}{}]", Float.toUtf8(tc._time[i], config.timing.precision), config.timing.postfix); 
     268                        Stdout.format(" [{}{}]", Float.toString(tc._time[i], config.timing.precision), config.timing.postfix); 
    269269                    Stdout.newline; 
    270270                } 
     
    275275                { 
    276276                    _outputLevel(outLevel); 
    277                     Stdout.format("-Avg: [{}{}], Total: [{}{}]", Float.toUtf8((totalCaseTime / tc._iterations), config.timing.precision), config.timing.postfix, Float.toUtf8(totalCaseTime, config.timing.precision), config.timing.postfix).newline; 
     277                    Stdout.format("-Avg: [{}{}], Total: [{}{}]", Float.toString((totalCaseTime / tc._iterations), config.timing.precision), config.timing.postfix, Float.toString(totalCaseTime, config.timing.precision), config.timing.postfix).newline; 
    278278                } 
    279279                outLevel--; 
     
    281281        } 
    282282        if (config.incremental && config.testTime) 
    283             Stdout.format("[{}{}]", Float.toUtf8(totalTime, config.timing.precision), config.timing.postfix).newline; 
     283            Stdout.format("[{}{}]", Float.toString(totalTime, config.timing.precision), config.timing.postfix).newline; 
    284284        if (config.incremental) 
    285285            Stdout.newline; 
     
    303303            Stdout.format("{}", this._name); 
    304304        if (config.testTime) 
    305             Stdout.format(" ({}{})", Float.toUtf8(totalTime, config.timing.precision), config.timing.postfix); 
     305            Stdout.format(" ({}{})", Float.toString(totalTime, config.timing.precision), config.timing.postfix); 
    306306        if (config.testName || config.testTime) 
    307307            Stdout.newline;  
     
    321321                    Stdout.format(" [{}]", config.status.text[tc._status[i]]); 
    322322                if (config.caseTime) 
    323                     Stdout.format(" ({}{})", Float.toUtf8(tc._time[i], config.timing.precision), config.timing.postfix); 
     323                    Stdout.format(" ({}{})", Float.toString(tc._time[i], config.timing.precision), config.timing.postfix); 
    324324                if (config.caseName) 
    325325                { 
  • trunk/tango/scrapple/util/uuid/Uuid.d

    r10 r39  
    140140    Returns the string representation of this UUID. 
    141141    */ 
    142     char[] toUtf8(char[] output = null) 
     142    char[] toString(char[] output = null) 
    143143    { 
    144144        if (output.length < 36) 
     
    179179    char[] toUrn() 
    180180    { 
    181         return "urn:uuid:" ~ toUtf8(); 
     181        return "urn:uuid:" ~ toString(); 
    182182    } 
    183183 
     
    316316    char[] opCast() 
    317317    { 
    318         return toUtf8
     318        return toString
    319319    } 
    320320 
     
    397397        char[] toCLSIDString() 
    398398        { 
    399             return "{" ~ toUtf8 ~ "}"; 
     399            return "{" ~ toString ~ "}"; 
    400400        } 
    401401 
     
    435435 
    436436        char[36] buffer; 
    437         uuid.toUtf8(buffer); 
     437        uuid.toString(buffer); 
    438438        assert(buffer == TEST_UUID_STR); 
    439439 
     
    441441        assert(uuid.ver == UuidVersion.TIME_BASED); 
    442442 
    443         auto uuid2 = Uuid(uuid.toUtf8); 
     443        auto uuid2 = Uuid(uuid.toString); 
    444444        assert(uuid == uuid2); 
    445445 
    446446        uuid = TEST_UUID_STR; 
    447         assert(uuid.toUtf8 == TEST_UUID_STR); 
     447        assert(uuid.toString == TEST_UUID_STR); 
    448448        assert(TEST_UUID_STR == cast(char[])uuid); 
    449449 
  • trunk/tango/scrapple/util/uuid/Uuid2.d

    r17 r39  
    198198        Returns the string representation of this UUID. 
    199199    */ 
    200     char[] toUtf8(char[] output = null) 
     200    char[] toString(char[] output = null) 
    201201    { 
    202202        if (output.length < 36) 
     
    237237    char[] toUrn() 
    238238    { 
    239         return "urn:uuid:" ~ toUtf8(); 
     239        return "urn:uuid:" ~ toString(); 
    240240    } 
    241241 
     
    368368    char[] opCast() 
    369369    { 
    370         return toUtf8
     370        return toString
    371371    } 
    372372 
     
    449449        char[] toCLSIDString() 
    450450        { 
    451             return "{" ~ toUtf8 ~ "}"; 
     451            return "{" ~ toString ~ "}"; 
    452452        } 
    453453 
     
    487487 
    488488        char[36] buffer; 
    489         uuid.toUtf8(buffer); 
     489        uuid.toString(buffer); 
    490490        assert(buffer == TEST_UUID_STR); 
    491491 
     
    493493        assert(uuid.ver == UuidVersion.TIME_BASED); 
    494494 
    495         auto uuid2 = Uuid(uuid.toUtf8); 
     495        auto uuid2 = Uuid(uuid.toString); 
    496496        assert(uuid == uuid2); 
    497497 
    498498        uuid = TEST_UUID_STR; 
    499         assert(uuid.toUtf8 == TEST_UUID_STR); 
     499        assert(uuid.toString == TEST_UUID_STR); 
    500500        assert(TEST_UUID_STR == cast(char[])uuid); 
    501501 
  • trunk/tango/scrapple/util/uuid/Uuid3.d

    r17 r39  
    198198        Returns the string representation of this UUID. 
    199199    */ 
    200     char[] toUtf8(char[] output = null) 
     200    char[] toString(char[] output = null) 
    201201    { 
    202202        if (output.length < 36) 
     
    237237    char[] toUrn() 
    238238    { 
    239         return "urn:uuid:" ~ toUtf8(); 
     239        return "urn:uuid:" ~ toString(); 
    240240    } 
    241241 
     
    368368    char[] opCast() 
    369369    { 
    370         return toUtf8
     370        return toString
    371371    } 
    372372 
     
    449449        char[] toCLSIDString() 
    450450        { 
    451             return "{" ~ toUtf8 ~ "}"; 
     451            return "{" ~ toString ~ "}"; 
    452452        } 
    453453 
     
    487487 
    488488        char[36] buffer; 
    489         uuid.toUtf8(buffer); 
     489        uuid.toString(buffer); 
    490490        assert(buffer == TEST_UUID_STR); 
    491491 
     
    493493        assert(uuid.ver == UuidVersion.TIME_BASED); 
    494494 
    495         auto uuid2 = Uuid(uuid.toUtf8); 
     495        auto uuid2 = Uuid(uuid.toString); 
    496496        assert(uuid == uuid2); 
    497497 
    498498        uuid = TEST_UUID_STR; 
    499         assert(uuid.toUtf8 == TEST_UUID_STR); 
     499        assert(uuid.toString == TEST_UUID_STR); 
    500500        assert(TEST_UUID_STR == cast(char[])uuid); 
    501501