Ignore:
Timestamp:
Apr 12, 2000, 6:39:00 PM (25 years ago)
Author:
cbratschi
Message:

listview: ver 4 feature complete

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/CCBase.cpp

    r3280 r3369  
    1 /* $Id: CCBase.cpp,v 1.6 2000-03-30 15:39:08 cbratschi Exp $ */
     1/* $Id: CCBase.cpp,v 1.7 2000-04-12 16:38:58 cbratschi Exp $ */
    22/*
    33 * COMCTL32 Base Functions and Macros for all Controls
     
    88 */
    99
     10#include <string.h>
     11#include <wcstr.h>
    1012#include "winbase.h"
    1113#include "comctl32.h"
     
    320322  return res;
    321323}
     324
     325INT lstrcmpAW(WCHAR *textA,BOOL textaunicode,WCHAR *textB,BOOL textbunicode)
     326{
     327  if (textaunicode)
     328  {
     329    if (textbunicode)
     330    {
     331      return lstrcmpW(textA,textB);
     332    } else
     333    {
     334      return lstrcmpAtoW((LPSTR)textB,textA);
     335    }
     336  } else
     337  {
     338    if (textbunicode)
     339    {
     340      return lstrcmpAtoW((LPSTR)textA,textB);
     341    } else
     342    {
     343      return lstrcmpA((LPSTR)textA,(LPSTR)textB);
     344    }
     345  }
     346}
     347
     348CHAR* lstrstrA(CHAR *text,CHAR *subtext)
     349{
     350  return strstr(text,subtext);
     351}
     352
     353WCHAR* lstrstrW(WCHAR *text,WCHAR *subtext)
     354{
     355  return (WCHAR*)wcswcs((const wchar_t*)text,(wchar_t*)subtext);
     356}
     357
     358//NOTE: less information in ASCII subtext
     359CHAR* lstrstrAtoW(CHAR *text,WCHAR *subtext)
     360{
     361  INT len;
     362  CHAR *tmp,*res;
     363
     364  len = lstrlenW(subtext);
     365  if (len > 0)
     366  {
     367    len++;
     368    tmp = (CHAR*)COMCTL32_Alloc(len);
     369    lstrcpyWtoA(tmp,subtext);
     370  } else tmp = NULL;
     371
     372  res = strstr(text,tmp);
     373
     374  if (tmp) COMCTL32_Free(tmp);
     375  return res;
     376}
     377
     378WCHAR* lstrstrWtoA(WCHAR *text,CHAR *subtext)
     379{
     380  INT len;
     381  WCHAR *tmp,*res;
     382
     383  len = lstrlenA(subtext);
     384  if (len > 0)
     385  {
     386    len++;
     387    tmp = (WCHAR*)COMCTL32_Alloc(len*sizeof(WCHAR));
     388    lstrcpyAtoW(tmp,subtext);
     389  } else tmp = NULL;
     390
     391  res = (WCHAR*)wcswcs((const wchar_t*)text,(wchar_t*)tmp);
     392
     393  if (tmp) COMCTL32_Free(tmp);
     394  return res;
     395}
     396
     397WCHAR* lstrstrAW(WCHAR *text,BOOL textunicode,WCHAR *subtext,BOOL subtextunicode)
     398{
     399  if (textunicode)
     400  {
     401    if (subtextunicode)
     402    {
     403      return lstrstrW(text,subtext);
     404    } else
     405    {
     406      return lstrstrWtoA(text,(LPSTR)subtext);
     407    }
     408  } else
     409  {
     410    if (subtextunicode)
     411    {
     412      return (WCHAR*)lstrstrAtoW((LPSTR)text,subtext);
     413    } else
     414    {
     415      return (WCHAR*)lstrstrA((LPSTR)text,(LPSTR)subtext);
     416    }
     417  }
     418}
Note: See TracChangeset for help on using the changeset viewer.