Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.0 KiB

  1. // Strings.h : Declaration of the CStrings
  2. #ifndef __STRINGS_H_
  3. #define __STRINGS_H_
  4. #include "resource.h" // main symbols
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CStrings
  7. class ATL_NO_VTABLE CStrings :
  8. public CComObjectRootEx<CComSingleThreadModel>,
  9. public CComCoClass<CStrings, &CLSID_Strings>,
  10. public IDispatchImpl<IStrings, &IID_IStrings, &LIBID_DEVCON2Lib>
  11. {
  12. protected:
  13. BSTR *pMultiStrings;
  14. ULONG ArraySize;
  15. ULONG Count;
  16. VARIANT_BOOL IsCaseSensative;
  17. public:
  18. CStrings()
  19. {
  20. pMultiStrings = NULL;
  21. ArraySize = 0;
  22. Count = 0;
  23. IsCaseSensative = VARIANT_FALSE;
  24. }
  25. virtual ~CStrings();
  26. DECLARE_REGISTRY_RESOURCEID(IDR_STRINGS)
  27. DECLARE_PROTECT_FINAL_CONSTRUCT()
  28. BEGIN_COM_MAP(CStrings)
  29. COM_INTERFACE_ENTRY(IStrings)
  30. COM_INTERFACE_ENTRY(IDispatch)
  31. END_COM_MAP()
  32. // IStrings
  33. public:
  34. STDMETHOD(get_CaseSensative)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  35. STDMETHOD(put_CaseSensative)(/*[in]*/ VARIANT_BOOL newVal);
  36. STDMETHOD(Find)(/*[in]*/ BSTR name,/*[out,retval]*/ long *pFound);
  37. STDMETHOD(Remove)(/*[in]*/ VARIANT Index);
  38. STDMETHOD(Insert)(/*[in]*/ VARIANT Index,/*[in]*/ VARIANT Value);
  39. STDMETHOD(Add)(/*[in]*/ VARIANT Value);
  40. STDMETHOD(get__NewEnum)(/*[out, retval]*/ IUnknown** ppUnk);
  41. STDMETHOD(Item)(/*[in]*/ VARIANT Index,/*[out, retval]*/ VARIANT * pVal);
  42. STDMETHOD(get_Count)(/*[out, retval]*/ long *pVal);
  43. //
  44. // helpers
  45. //
  46. BOOL InternalEnum(DWORD index,BSTR *pNext);
  47. HRESULT GetIndex(VARIANT *pIndex,DWORD *pAt);
  48. HRESULT FromMultiSz(LPCWSTR pMultiSz);
  49. HRESULT GetMultiSz(LPWSTR *pResult,DWORD *pSize);
  50. HRESULT InternalInsertString(DWORD Index,BSTR pString);
  51. HRESULT InternalInsertCollection(DWORD Index,IEnumVARIANT * pEnum);
  52. HRESULT InternalInsertArray(DWORD Index, VARTYPE vt,SAFEARRAY * pArray);
  53. HRESULT InternalInsertArrayDim(CComObject<CStrings> *pStringTemp, VARTYPE vt, SAFEARRAY *pArray,long *pDims,UINT dim,UINT dims);
  54. HRESULT InternalInsert(DWORD Index,LPVARIANT Value);
  55. HRESULT InternalAdd(LPCWSTR Value,UINT len);
  56. BOOL IncreaseArraySize(DWORD strings);
  57. };
  58. #endif //__STRINGS_H_