repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
jacobussystems/IoTJackAC1
src/Connection.h
/* Connection.h By <NAME> Jacobus Systems, Brighton & Hove, UK http://www.jacobus.co.uk Provided under the MIT license: https://github.com/jacobussystems/ArdJack/blob/master/LICENSE Copyright (c) 2019 <NAME>, Jacobus Systems, Brighton & Hove, UK Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifdef ARDUINO #include <arduino.h> #else #include "stdafx.h" #endif #include "IoTMessage.h" #include "IoTObject.h" class FifoBuffer; class Route; class Connection : public IoTObject { protected: bool _CanInput; bool _CanOutput; char _CommandPrefix[10]; char _CommentPrefix[10]; bool _InputAnnounce; char _InputEncodingType[10]; IoTMessage _InputMsg; bool _OutputAnnounce; char _OutputEncodingType[10]; bool _WarnUnhandled; virtual bool Activate() override; virtual bool CheckAnnounce(bool output, const char* text); virtual bool ConfigureProperty(const char* propName, const char* propValue, const char* text); virtual bool ConfigureRoute(const char* propName, const char* propValue, const char* text); public: Route* DefaultRoute; uint8_t RouteCount; Route* Routes[ARDJACK_MAX_INPUT_ROUTES]; int RxCount; int RxEvents; int TxCount; int TxEvents; Connection(const char* name); ~Connection(); virtual bool AddConfig() override; virtual Route* AddRoute(Route* route); virtual Route* AddRoute(const char* name, int type, FifoBuffer* buffer, const char* prefix = ""); virtual bool AlwaysUseRoute(const char* name, bool state = true); virtual bool ClearRoutes(); virtual Route* LookupRoute(const char* name, bool quiet = false); virtual int LookupRouteIndex(const char* name, bool quiet = false); virtual bool OutputMessage(IoTMessage* msg); virtual bool OutputText(const char* text); virtual bool Poll() override; virtual bool PollInputs(int maxCount = 5); virtual bool PollOutputs(int maxCount = 5); virtual bool ProcessInput(const char* text); virtual bool RemoveRoute(const char* name); virtual bool RouteInputMessage(IoTMessage* msg, bool* routed); virtual bool SendQueuedOutput(const char* text); virtual bool SendText(const char* text); virtual bool SendTextQuiet(const char* text); };
jacobussystems/IoTJackAC1
src/Int8List.h
/* Int8List.h By <NAME> Jacobus Systems, Brighton & Hove, UK http://www.jacobus.co.uk Provided under the MIT license: https://github.com/jacobussystems/ArdJack/blob/master/LICENSE Copyright (c) 2019 <NAME>, Jacobus Systems, Brighton & Hove, UK Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifdef ARDUINO #include <arduino.h> #else #include "stdafx.h" #endif #include "Globals.h" class Dynamic; class Int8List { protected: int8_t* _Items; public: bool AutoExpand; uint8_t Count; uint8_t Size; Int8List(int size = 10, bool autoExpand = true); ~Int8List(); virtual bool Add(int8_t value); virtual bool Add(Dynamic* value); virtual void Clear(); virtual int8_t Get(int index, bool quiet = false); virtual int IndexOf(int8_t value, bool ignoreCase = true); virtual void LogIt(); virtual bool Put(int index, int8_t value); virtual bool Remove(int index); virtual bool SetSize(int size); };
jacobussystems/IoTJackAC1
src/Displayer.h
<reponame>jacobussystems/IoTJackAC1 /* Displayer.h By <NAME> Jacobus Systems, Brighton & Hove, UK http://www.jacobus.co.uk Provided under the MIT license: https://github.com/jacobussystems/ArdJack/blob/master/LICENSE Copyright (c) 2019 <NAME>, Jacobus Systems, Brighton & Hove, UK Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifdef ARDUINO #include <arduino.h> #else #include "stdafx.h" #endif #include "Globals.h" class Displayer { protected: static bool DisplayHeader(const char* heading, const char* name = ""); static bool DisplayObjectsOfType(int type); static bool SaveLogIncludeMemory; static bool SaveLogIncludeTime; public: static bool DisplayActive(IoTObject* obj); #ifdef ARDJACK_INCLUDE_BEACONS static bool DisplayBeacon(Beacon* Beacon); static bool DisplayBeacons(); #endif #ifdef ARDJACK_INCLUDE_BRIDGES static bool DisplayBridge(Bridge* bridge); static bool DisplayBridges(); #endif static bool DisplayConnection(Connection* conn); static bool DisplayConnections(); #ifdef ARDJACK_INCLUDE_DATALOGGERS static bool DisplayDataLogger(DataLogger* logger); static bool DisplayDataLoggers(); #endif static bool DisplayDevice(Device* dev); static bool DisplayDevices(); static bool DisplayFilter(Filter* filter); static bool DisplayFilters(); static bool DisplayItem(const char* args); static bool DisplayMacros(); static bool DisplayMemory(); static bool DisplayNetwork(); #ifdef ARDJACK_NETWORK_AVAILABLE static bool DisplayNetworkInterface(NetworkInterface* net); #endif static bool DisplayObject(IoTObject* obj); static bool DisplayObject2(char* text, bool quiet = false); static bool DisplayObjects(bool activeOnly); static bool DisplayPart(Device* dev, Part* part); static bool DisplaySize(const char* caption, int size); static bool DisplaySizes(); static bool DisplayStatus(); };
jacobussystems/IoTJackAC1
src/DetectBoard.h
/* DetectBoard.h By <NAME> Jacobus Systems, Brighton & Hove, UK http://www.jacobus.co.uk Provided under the MIT license: https://github.com/jacobussystems/ArdJack/blob/master/LICENSE Copyright (c) 2019 <NAME>, Jacobus Systems, Brighton & Hove, UK Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifdef ARDUINO // Arduino only. // Defaults. #define ARDJACK_BOARD_TYPE "UNKNOWN" #define ARDJACK_SRAM 2 #undef ARDJACK_ARM #undef ARDJACK_ETHERNET_AVAILABLE #undef ARDJACK_FLASH_AVAILABLE #undef ARDJACK_MALLOC_AVAILABLE #undef ARDJACK_NETWORK_AVAILABLE #undef ARDJACK_RTC_AVAILABLE #undef ARDJACK_WIFI_AVAILABLE #ifdef TEENSYDUINO // --------------- TEENSY ----------------- #if defined(__AVR_ATmega32U4__) #define TEENSY_2.0 #define ARDJACK_BOARD_TYPE "TEENSY_2.0" #elif defined(__AVR_AT90USB1286__) #define TEENSY++_2.0 #define ARDJACK_BOARD_TYPE "TEENSY++_2.0" #elif defined(__MK20DX128__) #define TEENSY_3.0 #define ARDJACK_BOARD_TYPE "TEENSY_3.0" #elif defined(__MK20DX256__) #define TEENSY_3.1 #define TEENSY_3.2 #define ARDJACK_BOARD_TYPE "TEENSY_3.1" // and TEENSY 3.2 #elif defined(__MKL26Z64__) #define TEENSY_LC #define ARDJACK_BOARD_TYPE "TEENSY_LC" #elif defined(__MK66FX1M0__) #define TEENSY++_3.0 // coming soon #define ARDJACK_BOARD_TYPE "TEENSY++_3.0" // coming soon #else #error "Unknown TEENSY board" #endif #else // --------------- Adafruit? ------------------ #if defined(ADAFRUIT_FEATHER_M0) #define ARDJACK_ARM #define ARDJACK_FEATHER_M0 #define ARDJACK_BOARD_TYPE "ADAFRUIT_FEATHER_M0" //#define ARDJACK_FLASH_AVAILABLE #define ARDJACK_MALLOC_AVAILABLE //#define ARDJACK_RTC_AVAILABLE #define ARDJACK_SRAM 32 #define ARDJACK_USE_RTCZERO #define ARDJACK_WIFI_AVAILABLE // --------------- Arduino? ------------------ #elif defined(ARDUINO_ARC32_TOOLS) #define ARDUINO_101 #define ARDJACK_BOARD_TYPE "ARDUINO_101" #elif defined(ARDUINO_AVR_ADK) #define ARDUINO_ADK #define ARDJACK_BOARD_TYPE "ARDUINO_ADK" #elif defined(ARDUINO_AVR_BT) // Bluetooth #define ARDUINO_BT #define ARDJACK_BOARD_TYPE "ARDUINO_BT" #elif defined(ARDUINO_AVR_DUEMILANOVE) #define ARDUINO_DUEMILANOVE #define ARDJACK_BOARD_TYPE "ARDUINO_DUEMILANOVE" #elif defined(ARDUINO_AVR_ESPLORA) #define ARDUINO_ESPLORA #define ARDJACK_BOARD_TYPE "ARDUINO_ESPLORA" #elif defined(ARDUINO_AVR_ETHERNET) #define ARDUINO_ETHERNET #define ARDJACK_BOARD_TYPE "ARDUINO_ETHERNET" #elif defined(ARDUINO_AVR_FIO) #define ARDUINO_FIO #define ARDJACK_BOARD_TYPE "ARDUINO_FIO" #elif defined(ARDUINO_AVR_GEMMA) #define ARDUINO_GEMMA #define ARDJACK_BOARD_TYPE "ARDUINO_GEMMA" #elif defined(ARDUINO_AVR_LEONARDO) #define ARDUINO_LEONARDO #define ARDJACK_BOARD_TYPE "ARDUINO_LEONARDO" #elif defined(ARDUINO_AVR_LILYPAD) #define ARDUINO_LILYPAD #define ARDJACK_BOARD_TYPE "ARDUINO_LILYPAD" #elif defined(ARDUINO_AVR_LILYPAD_USB) #define ARDUINO_LILYPAD_USB #define ARDJACK_BOARD_TYPE "ARDUINO_LILYPAD_USB" #elif defined(ARDUINO_AVR_MEGA) #define ARDUINO_MEGA #define ARDJACK_BOARD_TYPE "ARDUINO_MEGA" #elif defined(ARDUINO_AVR_MEGA2560) #define ARDJACK_ARDUINO_MEGA2560 #define ARDJACK_BOARD_TYPE "ARDUINO_MEGA_2560" #define ARDJACK_SRAM 8 #elif defined(ARDUINO_AVR_MICRO) #define ARDUINO_MICRO #define ARDJACK_BOARD_TYPE "ARDUINO_MICRO" #elif defined(ARDUINO_AVR_MINI) #define ARDUINO_MINI #define ARDJACK_BOARD_TYPE "ARDUINO_MINI" #elif defined(ARDUINO_AVR_NANO) #define ARDUINO_NANO #define ARDJACK_BOARD_TYPE "ARDUINO_NANO" #elif defined(ARDUINO_AVR_NG) #define ARDUINO_NG #define ARDJACK_BOARD_TYPE "ARDUINO_NG" #elif defined(ARDUINO_AVR_PRO) #define ARDUINO_PRO #define ARDJACK_BOARD_TYPE "ARDUINO_PRO" #elif defined(ARDUINO_AVR_ROBOT_CONTROL) #define ARDUINO_ROBOT_CONTROL #define ARDJACK_BOARD_TYPE "ARDUINO_ROBOT_CONTROL" #elif defined(ARDUINO_AVR_ROBOT_MOTOR) #define ARDUINO_ROBOT_MOTOR #define ARDJACK_BOARD_TYPE "ARDUINO_ROBOT_MOTOR" #elif defined(ARDUINO_AVR_UNO) #define ARDJACK_ARDUINO_UNO #define ARDJACK_BOARD_TYPE "ARDUINO_UNO" #elif defined(ARDUINO_AVR_YUN) #define ARDUINO_YUN #define ARDJACK_BOARD_TYPE "ARDUINO_YUN" #elif defined(ARDUINO_SAM_DUE) #define ARDJACK_ARM #define ARDJACK_ARDUINO_DUE #define ARDJACK_BOARD_TYPE "ARDUINO_DUE" //#define ARDJACK_ETHERNET_AVAILABLE #define ARDJACK_MALLOC_AVAILABLE //#define ARDJACK_RTC_AVAILABLE #define ARDJACK_SRAM 96 #elif defined(ARDUINO_SAMD_MKR1000) #define ARDJACK_ARM #define ARDJACK_ARDUINO_MKR #define ARDJACK_BOARD_TYPE "ARDUINO_MKR1000" //#define ARDJACK_FLASH_AVAILABLE #define ARDJACK_MALLOC_AVAILABLE //#define ARDJACK_RTC_AVAILABLE #define ARDJACK_SRAM 32 #define ARDJACK_USE_RTCZERO //#define ARDJACK_WIFI_AVAILABLE #elif defined(ARDUINO_SAMD_MKRFox1200) #define ARDJACK_ARM #define ARDJACK_ARDUINO_MKR #define ARDJACK_BOARD_TYPE "ARDUINO_MKR_FOX_1200" //#define ARDJACK_FLASH_AVAILABLE #define ARDJACK_MALLOC_AVAILABLE //#define ARDJACK_RTC_AVAILABLE #define ARDJACK_SRAM 32 //#define ARDJACK_WIFI_AVAILABLE #elif defined(ARDUINO_SAMD_MKRWIFI1010) #define ARDJACK_ARM #define ARDJACK_ARDUINO_MKR #define ARDJACK_BOARD_TYPE "ARDUINO_MKR_WIFI_1010" //#define ARDJACK_FLASH_AVAILABLE #define ARDJACK_MALLOC_AVAILABLE //#define ARDJACK_RTC_AVAILABLE #define ARDJACK_SRAM 32 #define ARDJACK_USE_RTCZERO #define ARDJACK_WIFI_AVAILABLE #elif defined(ARDUINO_SAMD_ZERO) #define ARDJACK_ARM #define ARDJACK_ARDUINO_SAMD_ZERO #define ARDJACK_BOARD_TYPE "ARDUINO_SAMD_ZERO" //#define ARDJACK_FLASH_AVAILABLE #define ARDJACK_MALLOC_AVAILABLE //#define ARDJACK_RTC_AVAILABLE #define ARDJACK_SRAM 32 //#define ARDJACK_WIFI_AVAILABLE // --------------- Espressif? ------------------ #elif defined(ESP32) #define ARDJACK_ESP32 #define ARDJACK_BOARD_TYPE "ESPRESSIF_ESP32" //#define ARDJACK_FLASH_AVAILABLE #define ARDJACK_MALLOC_AVAILABLE //#define ARDJACK_RTC_AVAILABLE #define ARDJACK_SRAM 320 #define ARDJACK_WIFI_AVAILABLE #define SERIAL_PORT_MONITOR Serial #else #error "Unknown board" #endif #endif #ifdef ARDJACK_ETHERNET_AVAILABLE #define ARDJACK_NETWORK_AVAILABLE #endif #ifdef ARDJACK_WIFI_AVAILABLE #define ARDJACK_NETWORK_AVAILABLE #endif #endif
jacobussystems/IoTJackAC1
src/Tests.h
<reponame>jacobussystems/IoTJackAC1<gh_stars>0 /* Tests.h By <NAME> Jacobus Systems, Brighton & Hove, UK http://www.jacobus.co.uk Provided under the MIT license: https://github.com/jacobussystems/ArdJack/blob/master/LICENSE Copyright (c) 2019 <NAME>, Jacobus Systems, Brighton & Hove, UK Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #ifdef ARDUINO #include <arduino.h> #else #include "stdafx.h" #endif #include "Globals.h" #ifdef ARDJACK_INCLUDE_TESTS void RunTest(int number, int arg1, int arg2, int verbosity); void RunTests(int verbosity); //bool Test_FifoBuffer1(); //bool Test_FifoBuffer2(); //void Test1(); //void Test2(); //void Test3(); //void Test4(); //void Test5(); //void Test6(); //void Test7(); //void Test8(); //void Test9(); //void Test10(); //void Test11(); //void Test12(); //void Test13(); //void Test14(); //void Test15(); #endif
petus/ESP32_SCD41_CozIR-LP_SHT40_ePaper-home-monitor
OpenSansSB_14px.h
// Created by http://oleddisplay.squix.ch/ Consider a donation // In case of problems make sure that you are using the font file with the correct version! const uint8_t Open_Sans_SemiBold_14Bitmaps[] PROGMEM = { // Bitmap Data: 0x00, // ' ' 0xDB,0x6D,0xB0,0xD8, // '!' 0x94,0xA5,0x20, // '"' 0x1A,0x04,0x81,0x21,0xFE,0x16,0x0D,0x0F,0xF0,0x90,0x24,0x0B,0x00, // '#' 0x20,0xFB,0x85,0x0E,0x0F,0x0B,0x12,0x2D,0xF0,0x80, // '$' 0xE1,0x16,0x62,0x48,0x4A,0x0B,0x5D,0xD6,0x82,0x90,0x92,0x33,0x44,0x38, // '%' 0x78,0x13,0x04,0xC1,0xE0,0x30,0x3C,0x4C,0xB2,0x18,0xC6,0x1E,0xC0, // '&' 0xAA, // ''' 0x4C,0xC8,0x88,0x88,0x88,0xC4, // '(' 0x43,0x18,0x42,0x10,0x84,0x21,0x18,0x80, // ')' 0x30,0x63,0xF1,0x87,0x89,0x00, // '*' 0x30,0x60,0xC7,0xE3,0x06,0x0C,0x00, // '+' 0x64,0x40, // ',' 0xE0, // '-' 0xD8, // '.' 0x18,0x41,0x0C,0x20,0x86,0x10,0x43,0x00, // '/' 0x79,0x9A,0x14,0x28,0x50,0xA1,0x42,0xCC,0xF0, // '0' 0x33,0xB4,0x21,0x08,0x42,0x10,0x80, // '1' 0xF9,0x18,0x30,0x60,0xC3,0x0C,0x30,0xC1,0xF8, // '2' 0xF9,0x18,0x30,0x67,0x01,0x81,0x02,0x0D,0xF0, // '3' 0x04,0x06,0x07,0x02,0x82,0x43,0x21,0x11,0xFE,0x04,0x02,0x00, // '4' 0xFD,0x83,0x06,0x0F,0x81,0x81,0x02,0x0D,0xF0, // '5' 0x3C,0xC3,0x04,0x0B,0x99,0xA1,0x42,0xCC,0xF0, // '6' 0xFC,0x18,0x30,0x41,0x82,0x0C,0x18,0x60,0xC0, // '7' 0x79,0x9A,0x16,0x67,0x9F,0xA1,0x42,0xCC,0xF0, // '8' 0x79,0x9A,0x14,0x2C,0xCE,0x81,0x06,0x19,0xE0, // '9' 0xD8,0x00,0x36, // ':' 0x66,0x00,0x00,0x06,0x44, // ';' 0x04,0x39,0xC6,0x06,0x03,0x81,0x00, // '<' 0xFC,0x00,0x07,0xE0, // '=' 0x81,0xC0,0xE0,0x61,0x9C,0x20,0x00, // '>' 0xF8,0x18,0x30,0x41,0x86,0x08,0x00,0x20,0x40, // '?' 0x1F,0x83,0x0C,0x40,0x6C,0xF2,0x91,0x29,0x12,0x93,0x29,0xFC,0xC0,0x06,0x08,0x1F,0x00, // '@' 0x1C,0x05,0x01,0x40,0xD8,0x36,0x08,0x87,0xF1,0x0C,0x41,0x30,0x60, // 'A' 0xFC,0xC6,0xC6,0xC6,0xF8,0xC6,0xC2,0xC2,0xC6,0xFC, // 'B' 0x3F,0x30,0x30,0x18,0x0C,0x06,0x03,0x01,0x80,0x60,0x1F,0x00, // 'C' 0xFC,0x63,0x30,0xD8,0x6C,0x36,0x1B,0x0D,0x86,0xC6,0x7E,0x00, // 'D' 0xFD,0x83,0x06,0x0F,0xD8,0x30,0x60,0xC1,0xF8, // 'E' 0xFD,0x83,0x06,0x0F,0x98,0x30,0x60,0xC1,0x80, // 'F' 0x3F,0x30,0x30,0x18,0x0C,0x06,0x7B,0x0D,0x86,0x63,0x1F,0x80, // 'G' 0xC1,0xB0,0x6C,0x1B,0x06,0xFF,0xB0,0x6C,0x1B,0x06,0xC1,0xB0,0x60, // 'H' 0xDB,0x6D,0xB6,0xD8, // 'I' 0x31,0x8C,0x63,0x18,0xC6,0x31,0x8C,0x6E,0x00, // 'J' 0xC2,0x63,0x33,0x1B,0x0F,0x07,0xC3,0x31,0x98,0xC6,0x61,0x80, // 'K' 0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xFE, // 'L' 0xE0,0xEE,0x0E,0xF1,0xEF,0x16,0xD1,0x6D,0xB6,0xDA,0x6C,0xA6,0xCE,0x6C,0xC6, // 'M' 0xE1,0xB8,0x6F,0x1B,0x46,0xD9,0xB3,0x6C,0x5B,0x1E,0xC3,0xB0,0xE0, // 'N' 0x3E,0x18,0xCC,0x1B,0x06,0xC1,0xB0,0x6C,0x1B,0x06,0x63,0x0F,0x80, // 'O' 0xFC,0xC6,0xC2,0xC2,0xC6,0xFC,0xC0,0xC0,0xC0,0xC0, // 'P' 0x3E,0x18,0xCC,0x1B,0x06,0xC1,0xB0,0x6C,0x1B,0x06,0x63,0x0F,0x80,0x60,0x0C, // 'Q' 0xFC,0x63,0x31,0x98,0xCC,0x67,0xC3,0x31,0x88,0xC6,0x61,0x80, // 'R' 0x7D,0x8A,0x06,0x07,0x07,0x83,0x02,0x0D,0xF0, // 'S' 0xFF,0x0C,0x06,0x03,0x01,0x80,0xC0,0x60,0x30,0x18,0x0C,0x00, // 'T' 0xC3,0x61,0xB0,0xD8,0x6C,0x36,0x1B,0x0D,0x86,0x42,0x1E,0x00, // 'U' 0xC1,0x90,0x46,0x31,0x8C,0x22,0x0D,0x83,0x60,0x50,0x1C,0x07,0x00, // 'V' 0xC2,0x1B,0x1C,0x64,0x51,0x19,0x4C,0x6D,0xB1,0xB6,0xC2,0x8A,0x0A,0x28,0x38,0xE0,0xE3,0x80, // 'W' 0x41,0x18,0xC3,0x60,0x50,0x1C,0x07,0x03,0x60,0x98,0x63,0x30,0x60, // 'X' 0xC3,0x31,0x19,0x86,0x83,0xC0,0xC0,0x60,0x30,0x18,0x0C,0x00, // 'Y' 0x7E,0x03,0x01,0x01,0x81,0x80,0xC0,0xC0,0xC0,0x60,0x7F,0x80, // 'Z' 0xF6,0x31,0x8C,0x63,0x18,0xC6,0x31,0xE0, // '[' 0xC1,0x04,0x18,0x20,0x83,0x04,0x10,0x60, // '\' 0xF1,0x8C,0x63,0x18,0xC6,0x31,0x8D,0xE0, // ']' 0x18,0x0C,0x0B,0x04,0x84,0x26,0x18, // '^' 0xFC, // '_' 0x61,0x00, // '`' 0xF8,0x18,0x33,0xEC,0xD1,0xA3,0x7A, // 'a' 0xC0,0xC0,0xC0,0xFC,0xC6,0xC6,0xC2,0xC2,0xC6,0xC6,0xFC, // 'b' 0x79,0x83,0x04,0x08,0x18,0x30,0x3C, // 'c' 0x06,0x06,0x06,0x7E,0xC6,0xC6,0x86,0x86,0xC6,0xC6,0x7E, // 'd' 0x79,0x9A,0x17,0xE8,0x18,0x30,0x3E, // 'e' 0x3C,0x41,0x87,0xC6,0x0C,0x18,0x30,0x60,0xC1,0x80, // 'f' 0x3F,0x33,0x11,0x8C,0xC3,0xC2,0x00,0xF9,0x86,0xC3,0x61,0x1F,0x00, // 'g' 0xC0,0xC0,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, // 'h' 0xD8,0x6D,0xB6,0xDB,0x00, // 'i' 0x31,0x80,0x63,0x18,0xC6,0x31,0x8C,0x63,0x70, // 'j' 0xC0,0xC0,0xC0,0xCC,0xC8,0xD8,0xF0,0xF0,0xD8,0xCC,0xC6, // 'k' 0xDB,0x6D,0xB6,0xDB,0x00, // 'l' 0xBD,0xCC,0xE6,0xC4,0x6C,0x46,0xC4,0x6C,0x46,0xC4,0x6C,0x46, // 'm' 0xBC,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6, // 'n' 0x7C,0xC6,0xC6,0x82,0x82,0xC6,0xC6,0x7C, // 'o' 0xFC,0xC6,0xC6,0xC2,0xC2,0xC6,0xC6,0xFC,0xC0,0xC0,0xC0, // 'p' 0x7E,0xC6,0xC6,0x86,0x86,0xC6,0xC6,0x7E,0x06,0x06,0x06, // 'q' 0x9B,0xEC,0x30,0xC3,0x0C,0x30, // 'r' 0x7A,0x08,0x3C,0x38,0x20,0xBC, // 's' 0x20,0x43,0xF3,0x06,0x0C,0x18,0x30,0x20,0x78, // 't' 0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E, // 'u' 0xC3,0x21,0x19,0x8C,0xC2,0x41,0xE0,0x60,0x30, // 'v' 0xCE,0x6C,0xA4,0x4A,0x46,0xAC,0x7A,0xC7,0xB8,0x31,0x83,0x18, // 'w' 0x42,0x33,0x0F,0x03,0x01,0x81,0xE1,0x98,0x84, // 'x' 0xC3,0x21,0x19,0x8C,0xC2,0x41,0xE0,0x60,0x30,0x18,0x18,0x38,0x00, // 'y' 0x7C,0x18,0x20,0xC3,0x04,0x18,0x7E, // 'z' 0x18,0xC2,0x08,0x23,0x06,0x08,0x20,0x83,0x06, // '{' 0xDB,0x6D,0xB6,0xDB,0x6D,0x80, // '|' 0xC1,0x82,0x08,0x20,0x63,0x08,0x20,0x86,0x30 // '}' }; const GFXglyph Open_Sans_SemiBold_14Glyphs[] PROGMEM = { // bitmapOffset, width, height, xAdvance, xOffset, yOffset { 0, 1, 1, 5, 0, 0 }, // ' ' { 1, 3, 10, 5, 1, -10 }, // '!' { 5, 5, 4, 7, 1, -10 }, // '"' { 8, 10, 10, 10, 0, -10 }, // '#' { 21, 7, 11, 9, 1, -11 }, // '$' { 31, 11, 10, 13, 1, -10 }, // '%' { 45, 10, 10, 11, 1, -10 }, // '&' { 58, 2, 4, 4, 1, -10 }, // ''' { 59, 4, 12, 5, 1, -10 }, // '(' { 65, 5, 12, 5, 0, -10 }, // ')' { 73, 7, 6, 9, 1, -11 }, // '*' { 79, 7, 7, 9, 1, -9 }, // '+' { 86, 4, 3, 5, 0, -1 }, // ',' { 88, 4, 1, 6, 1, -4 }, // '-' { 89, 3, 2, 5, 1, -2 }, // '.' { 90, 6, 10, 6, 0, -10 }, // '/' { 98, 7, 10, 9, 1, -10 }, // '0' { 107, 5, 10, 9, 1, -10 }, // '1' { 114, 7, 10, 9, 1, -10 }, // '2' { 123, 7, 10, 9, 1, -10 }, // '3' { 132, 9, 10, 9, 0, -10 }, // '4' { 144, 7, 10, 9, 1, -10 }, // '5' { 153, 7, 10, 9, 1, -10 }, // '6' { 162, 7, 10, 9, 1, -10 }, // '7' { 171, 7, 10, 9, 1, -10 }, // '8' { 180, 7, 10, 9, 1, -10 }, // '9' { 189, 3, 8, 5, 1, -8 }, // ':' { 192, 4, 10, 5, 0, -8 }, // ';' { 197, 7, 7, 9, 1, -9 }, // '<' { 204, 7, 4, 9, 1, -7 }, // '=' { 208, 7, 7, 9, 1, -9 }, // '>' { 215, 7, 10, 7, 0, -10 }, // '?' { 224, 12, 11, 14, 1, -10 }, // '@' { 241, 10, 10, 10, 0, -10 }, // 'A' { 254, 8, 10, 10, 1, -10 }, // 'B' { 264, 9, 10, 10, 1, -10 }, // 'C' { 276, 9, 10, 11, 1, -10 }, // 'D' { 288, 7, 10, 9, 1, -10 }, // 'E' { 297, 7, 10, 8, 1, -10 }, // 'F' { 306, 9, 10, 11, 1, -10 }, // 'G' { 318, 10, 10, 12, 1, -10 }, // 'H' { 331, 3, 10, 5, 1, -10 }, // 'I' { 335, 5, 13, 5, -1, -10 }, // 'J' { 344, 9, 10, 10, 1, -10 }, // 'K' { 356, 8, 10, 9, 1, -10 }, // 'L' { 366, 12, 10, 14, 1, -10 }, // 'M' { 381, 10, 10, 12, 1, -10 }, // 'N' { 394, 10, 10, 12, 1, -10 }, // 'O' { 407, 8, 10, 10, 1, -10 }, // 'P' { 417, 10, 12, 12, 1, -10 }, // 'Q' { 432, 9, 10, 10, 1, -10 }, // 'R' { 444, 7, 10, 9, 1, -10 }, // 'S' { 453, 9, 10, 9, 0, -10 }, // 'T' { 465, 9, 10, 11, 1, -10 }, // 'U' { 477, 10, 10, 10, 0, -10 }, // 'V' { 490, 14, 10, 14, 0, -10 }, // 'W' { 508, 10, 10, 10, 0, -10 }, // 'X' { 521, 9, 10, 9, 0, -10 }, // 'Y' { 533, 9, 10, 9, 0, -10 }, // 'Z' { 545, 5, 12, 6, 1, -10 }, // '[' { 553, 6, 10, 6, 0, -10 }, // '\' { 561, 5, 12, 6, 0, -10 }, // ']' { 569, 9, 6, 9, 0, -10 }, // '^' { 576, 7, 1, 7, 0, 1 }, // '_' { 577, 5, 2, 9, 2, -10 }, // '`' { 579, 7, 8, 9, 1, -8 }, // 'a' { 586, 8, 11, 10, 1, -11 }, // 'b' { 597, 7, 8, 8, 1, -8 }, // 'c' { 604, 8, 11, 10, 1, -11 }, // 'd' { 615, 7, 8, 9, 1, -8 }, // 'e' { 622, 7, 11, 6, 0, -11 }, // 'f' { 632, 9, 11, 9, 0, -8 }, // 'g' { 645, 8, 11, 10, 1, -11 }, // 'h' { 656, 3, 11, 5, 1, -11 }, // 'i' { 661, 5, 14, 5, -1, -11 }, // 'j' { 670, 8, 11, 9, 1, -11 }, // 'k' { 681, 3, 11, 5, 1, -11 }, // 'l' { 686, 12, 8, 14, 1, -8 }, // 'm' { 698, 8, 8, 10, 1, -8 }, // 'n' { 706, 8, 8, 10, 1, -8 }, // 'o' { 714, 8, 11, 10, 1, -8 }, // 'p' { 725, 8, 11, 10, 1, -8 }, // 'q' { 736, 6, 8, 7, 1, -8 }, // 'r' { 742, 6, 8, 8, 1, -8 }, // 's' { 748, 7, 10, 7, 0, -10 }, // 't' { 757, 8, 8, 10, 1, -8 }, // 'u' { 765, 9, 8, 9, 0, -8 }, // 'v' { 774, 12, 8, 12, 0, -8 }, // 'w' { 786, 9, 8, 9, 0, -8 }, // 'x' { 795, 9, 11, 9, 0, -8 }, // 'y' { 808, 7, 8, 8, 0, -8 }, // 'z' { 815, 6, 12, 6, 0, -10 }, // '{' { 824, 3, 14, 9, 3, -11 }, // '|' { 830, 6, 12, 6, 0, -10 } // '}' }; const GFXfont OpenSansSB_14px PROGMEM = { (uint8_t *)Open_Sans_SemiBold_14Bitmaps,(GFXglyph *)Open_Sans_SemiBold_14Glyphs,0x20, 0x7E, 20};
petus/ESP32_SCD41_CozIR-LP_SHT40_ePaper-home-monitor
OpenSansSB_24px.h
// Created by http://oleddisplay.squix.ch/ Consider a donation // In case of problems make sure that you are using the font file with the correct version! const uint8_t Open_Sans_SemiBold_24Bitmaps[] PROGMEM = { // Bitmap Data: 0x00, // ' ' 0xEE,0xEE,0xEE,0xEE,0xEE,0xEC,0x0E,0xEE,0xE0, // '!' 0x66,0x33,0x19,0x8C,0xC6,0x63,0x30, // '"' 0x06,0x30,0x0C,0x60,0x18,0xC0,0x71,0x80,0xC6,0x0F,0xFF,0x9F,0xFF,0x06,0x30,0x18,0xE0,0x31,0x83,0xFF,0xF7,0xFF,0xE3,0x8C,0x06,0x38,0x0C,0x60,0x18,0xC0,0x31,0x80, // '#' 0x06,0x00,0x30,0x07,0xF0,0xFF,0xC7,0x66,0x73,0x03,0x98,0x0E,0xC0,0x7E,0x00,0xFC,0x01,0xF8,0x0D,0xC0,0x67,0x03,0x3B,0x1B,0x9F,0xFC,0x7F,0x80,0x30,0x01,0x80, // '$' 0x3C,0x06,0x07,0xE0,0xE0,0xE6,0x0C,0x0C,0x71,0x80,0xC7,0x18,0x0C,0x73,0x00,0xC7,0x70,0x0E,0x66,0x78,0x7E,0xEF,0xC3,0xCC,0xCE,0x01,0xDC,0x60,0x19,0xC6,0x03,0x1C,0x60,0x71,0xC6,0x06,0x0C,0xE0,0xE0,0xFC,0x0C,0x07,0x80, // '%' 0x0F,0x80,0x0F,0xF0,0x03,0x8E,0x00,0xC3,0x80,0x30,0xE0,0x0E,0x70,0x01,0xFC,0x00,0x3C,0x00,0x3F,0x07,0x1F,0xE1,0xCF,0x3C,0xE3,0x83,0xB8,0xE0,0x7C,0x38,0x0F,0x07,0x0F,0xC1,0xFF,0xB8,0x1F,0x87,0x00, // '&' 0xDB,0x6D,0x80, // ''' 0x1C,0x30,0xE3,0x87,0x0C,0x38,0x70,0xE1,0xC3,0x87,0x0E,0x1C,0x38,0x30,0x70,0xE0,0xE0,0xC1,0xC0, // '(' 0xE0,0xC1,0xC1,0x83,0x83,0x06,0x0E,0x1C,0x38,0x70,0xE1,0xC3,0x87,0x0C,0x38,0x71,0xC3,0x0E,0x00, // ')' 0x0E,0x00,0xE0,0x0E,0x08,0x42,0xFF,0xEF,0xFE,0x0E,0x01,0xB0,0x3B,0x83,0x18,0x11,0x00, // '*' 0x06,0x00,0x30,0x01,0x80,0x0C,0x00,0x60,0x7F,0xFB,0xFF,0xC0,0xC0,0x06,0x00,0x30,0x01,0x80,0x0C,0x00, // '+' 0x73,0x39,0xCC,0x60, // ',' 0xFD,0xF8, // '-' 0xEE,0xEE, // '.' 0x03,0x80,0xC0,0x70,0x1C,0x06,0x03,0x80,0xE0,0x30,0x1C,0x06,0x03,0x80,0xE0,0x30,0x1C,0x07,0x01,0x80,0xE0,0x00, // '/' 0x1F,0x01,0xFE,0x1C,0x38,0xE1,0xCE,0x06,0x70,0x3B,0x81,0xDC,0x0E,0xE0,0x77,0x03,0xB8,0x1D,0xC0,0xEE,0x07,0x38,0x71,0xC3,0x87,0xF8,0x0F,0x80, // '0' 0x0E,0x1E,0x3E,0xF6,0xE6,0x46,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, // '1' 0x1F,0x83,0xFE,0x1C,0x38,0x01,0xC0,0x06,0x00,0x70,0x03,0x80,0x3C,0x01,0xC0,0x1C,0x01,0xC0,0x1C,0x01,0xC0,0x1C,0x01,0xC0,0x1F,0xFE,0xFF,0xF0, // '2' 0x3F,0x87,0xFE,0x18,0x38,0x01,0xC0,0x0E,0x00,0x70,0x07,0x03,0xF0,0x1F,0xC0,0x0F,0x00,0x1C,0x00,0xE0,0x07,0x00,0x7B,0x07,0x9F,0xF8,0x7F,0x00, // '3' 0x00,0xE0,0x03,0xC0,0x07,0x80,0x1B,0x00,0x7E,0x00,0xDC,0x03,0x38,0x0E,0x70,0x38,0xE0,0x61,0xC1,0x83,0x87,0xFF,0xEF,0xFF,0xC0,0x1C,0x00,0x38,0x00,0x70,0x00,0xE0, // '4' 0x7F,0xE3,0xFF,0x1C,0x00,0xE0,0x07,0x00,0x38,0x01,0xFE,0x0F,0xF8,0x01,0xE0,0x07,0x80,0x1C,0x00,0xE0,0x07,0x00,0x73,0x07,0x9F,0xF8,0x7F,0x00, // '5' 0x07,0xE0,0xFF,0x0F,0x00,0xE0,0x07,0x00,0x30,0x03,0x9E,0x1F,0xFC,0xF0,0xE7,0x03,0xB8,0x1D,0xC0,0xEE,0x07,0x38,0x39,0xE3,0x87,0xF8,0x0F,0x80, // '6' 0xFF,0xF7,0xFF,0x80,0x1C,0x01,0xC0,0x0E,0x00,0xE0,0x07,0x00,0x70,0x03,0x80,0x1C,0x01,0xC0,0x0E,0x00,0xE0,0x07,0x00,0x70,0x03,0x80,0x38,0x00, // '7' 0x1F,0x81,0xFE,0x1C,0x38,0xC0,0xC6,0x06,0x38,0x71,0xE7,0x07,0xF0,0x1F,0x83,0xDE,0x1C,0x39,0xC0,0xEE,0x07,0x70,0x3B,0xC3,0x8F,0xFC,0x1F,0x80, // '8' 0x1F,0x01,0xFE,0x1C,0x79,0xC1,0xCE,0x07,0x70,0x3B,0x81,0xDC,0x0E,0x70,0xF3,0xFF,0x87,0xDC,0x00,0xC0,0x0E,0x00,0x70,0x0F,0x0F,0xF0,0x7E,0x00, // '9' 0xEE,0xEE,0x00,0x00,0x0E,0xEE,0xE0, // ':' 0x73,0x9C,0xE0,0x00,0x00,0x00,0x1C,0xE6,0x73,0x18, // ';' 0x00,0x10,0x03,0x80,0x78,0x0F,0x01,0xE0,0x7C,0x03,0xC0,0x0F,0x80,0x0F,0x80,0x1F,0x00,0x3C,0x00,0x20, // '<' 0xFF,0xF7,0xFF,0x80,0x00,0x00,0x00,0x00,0x7F,0xFB,0xFF,0xC0, // '=' 0x80,0x07,0x00,0x1E,0x00,0x3C,0x00,0x78,0x00,0xF8,0x03,0xC0,0x7C,0x1F,0x03,0xE0,0x3C,0x01,0x00,0x00, // '>' 0x3F,0x1F,0xF1,0x87,0x00,0x60,0x0C,0x03,0x80,0xF0,0x3C,0x0F,0x01,0x80,0x70,0x0E,0x00,0x00,0x38,0x07,0x00,0xE0,0x1C,0x00, // '?' 0x01,0xFC,0x00,0x3F,0xF8,0x03,0x80,0xE0,0x30,0x01,0x83,0x00,0x0E,0x38,0x7E,0x31,0x8F,0xF1,0x8C,0x61,0x86,0xE7,0x0C,0x36,0x30,0x63,0xB1,0x83,0x19,0xCE,0x38,0xC6,0x3F,0xFC,0x30,0xF1,0xC1,0xC0,0x00,0x06,0x00,0x00,0x1C,0x02,0x00,0x7F,0xF0,0x00,0xFF,0x00, // '@' 0x03,0xC0,0x01,0xE0,0x01,0xF0,0x00,0xFC,0x00,0x66,0x00,0x73,0x80,0x39,0xC0,0x18,0x60,0x1C,0x38,0x0E,0x1C,0x0F,0xFF,0x07,0xFF,0x83,0x81,0xC3,0x80,0x71,0xC0,0x38,0xC0,0x1C,0xE0,0x07,0x00, // 'A' 0xFF,0x83,0xFF,0x8E,0x0F,0x38,0x1C,0xE0,0x73,0x81,0xCE,0x0E,0x3F,0xF0,0xFF,0xE3,0x83,0xCE,0x07,0x38,0x0E,0xE0,0x3B,0x81,0xEE,0x0F,0x3F,0xF8,0xFF,0xC0, // 'B' 0x07,0xF0,0x7F,0xE3,0xC1,0x8E,0x00,0x70,0x01,0xC0,0x07,0x00,0x38,0x00,0xE0,0x03,0x80,0x06,0x00,0x1C,0x00,0x70,0x01,0xE0,0x03,0xC0,0x87,0xFE,0x07,0xF0, // 'C' 0xFF,0x80,0xFF,0xE0,0xE0,0xF0,0xE0,0x38,0xE0,0x1C,0xE0,0x1C,0xE0,0x1C,0xE0,0x0E,0xE0,0x0E,0xE0,0x0C,0xE0,0x1C,0xE0,0x1C,0xE0,0x1C,0xE0,0x38,0xE0,0xF0,0xFF,0xE0,0xFF,0x80, // 'D' 0xFF,0xDF,0xFB,0x80,0x70,0x0E,0x01,0xC0,0x38,0x07,0xFC,0xFF,0x9C,0x03,0x80,0x70,0x0E,0x01,0xC0,0x38,0x07,0xFE,0xFF,0xC0, // 'E' 0xFF,0xDF,0xFB,0x80,0x70,0x0E,0x01,0xC0,0x38,0x07,0x00,0xFF,0xDF,0xFB,0x80,0x70,0x0E,0x01,0xC0,0x38,0x07,0x00,0xE0,0x00, // 'F' 0x03,0xF8,0x1F,0xF8,0xF8,0x21,0xC0,0x07,0x00,0x0E,0x00,0x1C,0x00,0x70,0x00,0xE0,0xFD,0xC1,0xF9,0x80,0x73,0x80,0xE7,0x01,0xCF,0x03,0x8F,0x07,0x0F,0xFE,0x07,0xF8, // 'G' 0xE0,0x1D,0xC0,0x3B,0x80,0x77,0x00,0xEE,0x01,0xDC,0x03,0xB8,0x07,0x7F,0xFE,0xFF,0xFD,0xC0,0x3B,0x80,0x77,0x00,0xEE,0x01,0xDC,0x03,0xB8,0x07,0x70,0x0E,0xE0,0x1C, // 'H' 0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xE0, // 'I' 0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x1C,0xFC,0xF0, // 'J' 0xE0,0x73,0x83,0xCE,0x0E,0x38,0x70,0xE3,0x83,0x9C,0x0E,0xE0,0x3F,0x80,0xFE,0x03,0xDC,0x0E,0x78,0x38,0xE0,0xE1,0xC3,0x87,0x8E,0x0E,0x38,0x1C,0xE0,0x78, // 'K' 0xE0,0x1C,0x03,0x80,0x70,0x0E,0x01,0xC0,0x38,0x07,0x00,0xE0,0x1C,0x03,0x80,0x70,0x0E,0x01,0xC0,0x38,0x07,0xFE,0xFF,0xC0, // 'L' 0xF0,0x03,0xDF,0x00,0xFB,0xE0,0x1F,0x7C,0x03,0xEF,0xC0,0xFD,0xD8,0x1B,0xBB,0x07,0x77,0x70,0xCE,0xE6,0x19,0xDC,0xC7,0x3B,0x9C,0xC7,0x71,0x98,0xEE,0x3F,0x1D,0xC7,0xC3,0xB8,0x78,0x77,0x0F,0x0E,0xE1,0xC1,0xC0, // 'M' 0xF0,0x0E,0xF8,0x0E,0xF8,0x0E,0xFC,0x0E,0xFE,0x0E,0xEE,0x0E,0xE7,0x0E,0xE7,0x0E,0xE3,0x8E,0xE1,0xCE,0xE1,0xCE,0xE0,0xEE,0xE0,0xFE,0xE0,0x7E,0xE0,0x3E,0xE0,0x3E,0xE0,0x1E, // 'N' 0x07,0xF0,0x07,0xFF,0x03,0xC1,0xE0,0xE0,0x38,0x70,0x07,0x1C,0x01,0xC7,0x00,0x73,0x80,0x0E,0xE0,0x03,0xB8,0x00,0xE7,0x00,0x71,0xC0,0x1C,0x70,0x07,0x0E,0x03,0x83,0xC1,0xE0,0x7F,0xF0,0x07,0xF0,0x00, // 'O' 0xFF,0x87,0xFF,0x38,0x39,0xC0,0xEE,0x07,0x70,0x3B,0x81,0xDC,0x3C,0xFF,0xC7,0xF8,0x38,0x01,0xC0,0x0E,0x00,0x70,0x03,0x80,0x1C,0x00,0xE0,0x00, // 'P' 0x07,0xF0,0x07,0xFF,0x03,0xC1,0xE0,0xE0,0x38,0x70,0x07,0x1C,0x01,0xC7,0x00,0x73,0x80,0x0E,0xE0,0x03,0xB8,0x00,0xE7,0x00,0x71,0xC0,0x1C,0x70,0x07,0x0E,0x03,0x83,0xC1,0xE0,0x7F,0xF0,0x07,0xF0,0x00,0x1E,0x00,0x03,0xC0,0x00,0x78,0x00,0x0F,0x00, // 'Q' 0xFF,0x03,0xFF,0x0E,0x1E,0x38,0x38,0xE0,0xE3,0x83,0x8E,0x0E,0x38,0x78,0xFF,0xC3,0xFC,0x0E,0x38,0x38,0xE0,0xE1,0xC3,0x83,0x8E,0x0E,0x38,0x1C,0xE0,0x70, // 'R' 0x1F,0x87,0xFC,0x70,0x4E,0x00,0xE0,0x0E,0x00,0x78,0x07,0xE0,0x1F,0x80,0x7C,0x01,0xE0,0x0E,0x00,0xE0,0x0E,0xC1,0xCF,0xFC,0x7F,0x00, // 'S' 0xFF,0xFD,0xFF,0xF8,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x03,0x00,0x06,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x03,0x00, // 'T' 0xE0,0x1D,0xC0,0x3B,0x80,0x77,0x00,0xEE,0x01,0xDC,0x03,0xB8,0x07,0x70,0x0E,0xE0,0x1D,0xC0,0x3B,0x80,0x77,0x00,0xEE,0x01,0xCE,0x07,0x1E,0x1E,0x1F,0xF8,0x0F,0xC0, // 'U' 0xE0,0x0E,0x60,0x0C,0x70,0x1C,0x70,0x1C,0x30,0x18,0x38,0x38,0x38,0x38,0x18,0x30,0x1C,0x70,0x1C,0x70,0x0C,0xE0,0x0E,0xE0,0x0E,0xE0,0x06,0xC0,0x07,0xC0,0x07,0xC0,0x03,0x80, // 'V' 0xE0,0x38,0x0E,0x60,0x38,0x0C,0x70,0x7C,0x1C,0x70,0x7C,0x1C,0x70,0x6C,0x1C,0x30,0xEC,0x18,0x38,0xEE,0x38,0x38,0xCE,0x38,0x38,0xC6,0x38,0x19,0xC7,0x30,0x1D,0xC7,0x70,0x1D,0x83,0x70,0x1D,0x83,0x70,0x0F,0x83,0xE0,0x0F,0x01,0xE0,0x0F,0x01,0xE0,0x07,0x01,0xC0, // 'W' 0x70,0x1C,0x70,0x1C,0x38,0x38,0x1C,0x70,0x1C,0x70,0x0E,0xE0,0x07,0xC0,0x07,0xC0,0x03,0x80,0x07,0xC0,0x0E,0xE0,0x0E,0xE0,0x1C,0x70,0x38,0x38,0x38,0x38,0x70,0x1C,0xE0,0x1E, // 'X' 0xE0,0x1C,0xE0,0x71,0xC0,0xE1,0xC3,0x83,0x87,0x03,0x9C,0x07,0x38,0x07,0xE0,0x07,0x80,0x0F,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x60,0x00,0xC0,0x01,0x80,0x03,0x00, // 'Y' 0xFF,0xF7,0xFF,0x80,0x38,0x01,0xC0,0x1C,0x01,0xC0,0x0E,0x00,0xE0,0x0E,0x00,0x70,0x07,0x00,0x70,0x03,0x80,0x38,0x03,0x80,0x1F,0xFE,0xFF,0xF0, // 'Z' 0xFB,0xEC,0x30,0xC3,0x0C,0x30,0xC3,0x0C,0x30,0xC3,0x0C,0x30,0xC3,0x0C,0x3E,0xF8, // '[' 0xE0,0x18,0x07,0x01,0xC0,0x30,0x0E,0x03,0x80,0x60,0x1C,0x03,0x00,0xE0,0x38,0x06,0x01,0xC0,0x70,0x0C,0x03,0x80, // '\' 0xFB,0xE1,0x86,0x18,0x61,0x86,0x18,0x61,0x86,0x18,0x61,0x86,0x18,0x61,0xBE,0xF8, // ']' 0x06,0x00,0x1C,0x00,0xF0,0x03,0x60,0x1D,0x80,0x63,0x03,0x8C,0x0C,0x18,0x30,0x61,0x80,0xC6,0x03,0x00, // '^' 0xFF,0xDF,0xF8, // '_' 0xF0,0xE0,0xE0,0xE0, // '`' 0x1F,0x83,0xFC,0x30,0xE0,0x0E,0x00,0xE1,0xFE,0x7F,0xEF,0x0E,0xE0,0xEE,0x0E,0xE1,0xE7,0xF6,0x3E,0x60, // 'a' 0xE0,0x07,0x00,0x38,0x01,0xC0,0x0E,0x00,0x77,0xC3,0xFF,0x1E,0x1C,0xE0,0xE7,0x03,0xB8,0x1D,0xC0,0xEE,0x07,0x70,0x3B,0x83,0x9E,0x1C,0xDF,0xC6,0x7C,0x00, // 'b' 0x0F,0xC7,0xF9,0xE0,0x38,0x0E,0x01,0xC0,0x38,0x07,0x00,0xE0,0x0E,0x01,0xE1,0x1F,0xE1,0xF8, // 'c' 0x00,0x70,0x03,0x80,0x1C,0x00,0xE0,0x07,0x0F,0xB8,0xFF,0xCE,0x1E,0x70,0x77,0x03,0xB8,0x1D,0xC0,0xEE,0x07,0x70,0x39,0xC1,0xCE,0x1E,0x3F,0xF0,0xF9,0x80, // 'd' 0x0F,0x81,0xFE,0x1C,0x38,0xE0,0xEE,0x07,0x7F,0xFB,0xFF,0xDC,0x00,0xE0,0x03,0x80,0x1E,0x08,0x7F,0xC0,0xFC,0x00, // 'e' 0x07,0xC3,0xF0,0x70,0x0C,0x01,0x80,0xFF,0x3F,0xE0,0xC0,0x18,0x03,0x00,0x60,0x0C,0x01,0x80,0x30,0x06,0x00,0xC0,0x18,0x03,0x00, // 'f' 0x0F,0xF8,0xFF,0xE3,0x8E,0x1C,0x38,0x70,0xE1,0xC3,0x83,0x8E,0x0F,0xF0,0x1F,0x80,0xC0,0x03,0x00,0x0F,0xF8,0x3F,0xF1,0xC1,0xCE,0x03,0x38,0x0C,0xE0,0x71,0xFF,0x83,0xF8,0x00, // 'g' 0xE0,0x0E,0x00,0xE0,0x0E,0x00,0xE0,0x0E,0xF8,0xFF,0xCF,0x0E,0xE0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE0,0xEE,0x0E, // 'h' 0xEE,0xE0,0x0E,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE, // 'i' 0x1C,0x38,0x70,0x00,0x03,0x87,0x0E,0x1C,0x38,0x70,0xE1,0xC3,0x87,0x0E,0x1C,0x38,0x70,0xE1,0xC3,0xBE,0x78, // 'j' 0xE0,0x07,0x00,0x38,0x01,0xC0,0x0E,0x00,0x70,0x73,0x87,0x1C,0x70,0xE7,0x07,0x70,0x3F,0x01,0xFC,0x0F,0xF0,0x73,0x83,0x8E,0x1C,0x38,0xE0,0xE7,0x07,0x80, // 'k' 0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE, // 'l' 0xCF,0x8F,0x8D,0xFD,0xFC,0xF1,0xF0,0xEE,0x0E,0x0E,0xE0,0xE0,0xEE,0x0E,0x0E,0xE0,0xE0,0xEE,0x0E,0x0E,0xE0,0xE0,0xEE,0x0E,0x0E,0xE0,0xE0,0xEE,0x0E,0x0E,0xE0,0xE0,0xE0, // 'm' 0xCF,0x8D,0xFC,0xF0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE0,0xE0, // 'n' 0x0F,0x80,0xFF,0x87,0x8F,0x1C,0x1C,0xE0,0x3B,0x80,0xEE,0x03,0xB8,0x0E,0xE0,0x39,0xC1,0xC7,0x8F,0x0F,0xF8,0x0F,0x80, // 'o' 0xCF,0x86,0xFE,0x3C,0x39,0xC1,0xCE,0x07,0x70,0x3B,0x81,0xDC,0x0E,0xE0,0x77,0x07,0x3C,0x39,0xFF,0x8E,0xF8,0x70,0x03,0x80,0x1C,0x00,0xE0,0x07,0x00,0x38,0x00, // 'p' 0x1F,0x31,0xFF,0x9C,0x3C,0xE0,0xEE,0x07,0x70,0x3B,0x81,0xDC,0x0E,0xE0,0x73,0x83,0x9C,0x3C,0x7F,0xE1,0xF7,0x00,0x38,0x01,0xC0,0x0E,0x00,0x70,0x03,0x80,0x1C, // 'q' 0xCF,0x6F,0x3F,0x9E,0x0E,0x07,0x03,0x81,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x00, // 'r' 0x3F,0x8F,0xF3,0x82,0x70,0x0F,0x00,0xF8,0x0F,0xE0,0x3C,0x01,0xC0,0x3B,0x07,0x7F,0xC7,0xF0, // 's' 0x18,0x0C,0x0E,0x0F,0xEF,0xF1,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x07,0x03,0x81,0xC0,0x7C,0x1E, // 't' 0xE0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE0,0xEE,0x0E,0xE1,0xE7,0xF6,0x3E,0x60, // 'u' 0xE0,0x39,0x80,0xC7,0x07,0x1C,0x1C,0x30,0xE0,0xE3,0x81,0x8E,0x07,0x70,0x1D,0xC0,0x36,0x00,0xD8,0x03,0xE0,0x07,0x00, // 'v' 0xE0,0xF0,0x73,0x07,0x83,0x1C,0x3C,0x38,0xE3,0xF1,0xC3,0x1B,0x8C,0x1C,0xCC,0xE0,0xE6,0x67,0x07,0x73,0xB8,0x1B,0x0D,0x80,0xD8,0x7C,0x07,0xC3,0xE0,0x1C,0x1E,0x00,0xE0,0x70,0x00, // 'w' 0x70,0x70,0xE3,0x83,0x8E,0x07,0x70,0x0D,0x80,0x3E,0x00,0x70,0x03,0xE0,0x1D,0xC0,0x77,0x03,0x8E,0x1C,0x1C,0x70,0x70, // 'x' 0xE0,0x39,0xC1,0xC7,0x07,0x1C,0x1C,0x38,0xE0,0xE3,0x81,0x8E,0x07,0x70,0x1D,0xC0,0x36,0x00,0xF8,0x01,0xE0,0x07,0x00,0x1C,0x00,0x70,0x03,0x80,0x1E,0x01,0xF0,0x07,0x80,0x00, // 'y' 0xFF,0xBF,0xE0,0x38,0x1C,0x0E,0x03,0x81,0xC0,0xE0,0x38,0x1C,0x0E,0x03,0xFE,0xFF,0x80, // 'z' 0x0E,0x1E,0x1C,0x18,0x18,0x18,0x18,0x38,0x38,0xF0,0xE0,0x78,0x38,0x18,0x18,0x18,0x18,0x18,0x1C,0x1E,0x06, // '{' 0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE, // '|' 0xE0,0xF0,0x70,0x30,0x30,0x30,0x30,0x38,0x38,0x1E,0x0E,0x3C,0x38,0x30,0x30,0x30,0x30,0x30,0x70,0xF0,0xE0 // '}' }; const GFXglyph Open_Sans_SemiBold_24Glyphs[] PROGMEM = { // bitmapOffset, width, height, xAdvance, xOffset, yOffset { 0, 1, 1, 7, 0, 0 }, // ' ' { 1, 4, 17, 8, 2, -17 }, // '!' { 10, 9, 6, 11, 1, -17 }, // '"' { 17, 15, 17, 17, 1, -17 }, // '#' { 49, 13, 19, 15, 1, -18 }, // '$' { 80, 20, 17, 22, 1, -17 }, // '%' { 123, 18, 17, 19, 1, -17 }, // '&' { 162, 3, 6, 7, 2, -17 }, // ''' { 165, 7, 21, 9, 1, -17 }, // '(' { 184, 7, 21, 9, 1, -17 }, // ')' { 203, 12, 11, 14, 1, -18 }, // '*' { 220, 13, 12, 15, 1, -15 }, // '+' { 240, 5, 6, 7, 1, -3 }, // ',' { 244, 7, 2, 9, 1, -8 }, // '-' { 246, 4, 4, 8, 2, -4 }, // '.' { 248, 10, 17, 10, 0, -17 }, // '/' { 270, 13, 17, 15, 1, -17 }, // '0' { 298, 8, 17, 15, 2, -17 }, // '1' { 315, 13, 17, 15, 1, -17 }, // '2' { 343, 13, 17, 15, 1, -17 }, // '3' { 371, 15, 17, 15, 0, -17 }, // '4' { 403, 13, 17, 15, 1, -17 }, // '5' { 431, 13, 17, 15, 1, -17 }, // '6' { 459, 13, 17, 15, 1, -17 }, // '7' { 487, 13, 17, 15, 1, -17 }, // '8' { 515, 13, 17, 15, 1, -17 }, // '9' { 543, 4, 13, 8, 2, -13 }, // ':' { 550, 5, 16, 8, 1, -13 }, // ';' { 560, 13, 12, 15, 1, -15 }, // '<' { 580, 13, 7, 15, 1, -12 }, // '=' { 592, 13, 12, 15, 1, -15 }, // '>' { 612, 11, 17, 12, 0, -17 }, // '?' { 636, 21, 19, 23, 1, -17 }, // '@' { 686, 17, 17, 17, 0, -17 }, // 'A' { 723, 14, 17, 17, 2, -17 }, // 'B' { 753, 14, 17, 16, 1, -17 }, // 'C' { 783, 16, 17, 19, 2, -17 }, // 'D' { 817, 11, 17, 14, 2, -17 }, // 'E' { 841, 11, 17, 14, 2, -17 }, // 'F' { 865, 15, 17, 18, 1, -17 }, // 'G' { 897, 15, 17, 19, 2, -17 }, // 'H' { 929, 4, 17, 8, 2, -17 }, // 'I' { 938, 8, 22, 8, -2, -17 }, // 'J' { 960, 14, 17, 16, 2, -17 }, // 'K' { 990, 11, 17, 14, 2, -17 }, // 'L' { 1014, 19, 17, 23, 2, -17 }, // 'M' { 1055, 16, 17, 20, 2, -17 }, // 'N' { 1089, 18, 17, 20, 1, -17 }, // 'O' { 1128, 13, 17, 16, 2, -17 }, // 'P' { 1156, 18, 21, 20, 1, -17 }, // 'Q' { 1204, 14, 17, 16, 2, -17 }, // 'R' { 1234, 12, 17, 14, 1, -17 }, // 'S' { 1260, 15, 17, 15, 0, -17 }, // 'T' { 1292, 15, 17, 19, 2, -17 }, // 'U' { 1324, 16, 17, 16, 0, -17 }, // 'V' { 1358, 24, 17, 24, 0, -17 }, // 'W' { 1409, 16, 17, 16, 0, -17 }, // 'X' { 1443, 15, 17, 15, 0, -17 }, // 'Y' { 1475, 13, 17, 15, 1, -17 }, // 'Z' { 1503, 6, 21, 9, 2, -17 }, // '[' { 1519, 10, 17, 10, 0, -17 }, // '\' { 1541, 6, 21, 9, 1, -17 }, // ']' { 1557, 14, 11, 14, 0, -17 }, // '^' { 1577, 11, 2, 11, 0, 2 }, // '_' { 1580, 7, 4, 15, 4, -19 }, // '`' { 1584, 12, 13, 15, 1, -13 }, // 'a' { 1604, 13, 18, 16, 2, -18 }, // 'b' { 1634, 11, 13, 13, 1, -13 }, // 'c' { 1652, 13, 18, 16, 1, -18 }, // 'd' { 1682, 13, 13, 15, 1, -13 }, // 'e' { 1704, 11, 18, 10, 0, -18 }, // 'f' { 1729, 14, 19, 14, 0, -13 }, // 'g' { 1763, 12, 18, 16, 2, -18 }, // 'h' { 1790, 4, 18, 8, 2, -18 }, // 'i' { 1799, 7, 24, 8, -1, -18 }, // 'j' { 1820, 13, 18, 15, 2, -18 }, // 'k' { 1850, 4, 18, 8, 2, -18 }, // 'l' { 1859, 20, 13, 24, 2, -13 }, // 'm' { 1892, 12, 13, 16, 2, -13 }, // 'n' { 1912, 14, 13, 16, 1, -13 }, // 'o' { 1935, 13, 19, 16, 2, -13 }, // 'p' { 1966, 13, 19, 16, 1, -13 }, // 'q' { 1997, 9, 13, 11, 2, -13 }, // 'r' { 2012, 11, 13, 13, 1, -13 }, // 's' { 2030, 9, 16, 10, 0, -16 }, // 't' { 2048, 12, 13, 16, 2, -13 }, // 'u' { 2068, 14, 13, 14, 0, -13 }, // 'v' { 2091, 21, 13, 21, 0, -13 }, // 'w' { 2126, 14, 13, 14, 0, -13 }, // 'x' { 2149, 14, 19, 14, 0, -13 }, // 'y' { 2183, 10, 13, 12, 1, -13 }, // 'z' { 2200, 8, 21, 10, 1, -17 }, // '{' { 2221, 4, 24, 14, 5, -18 }, // '|' { 2233, 8, 21, 10, 1, -17 } // '}' }; const GFXfont OpenSansSB_24px PROGMEM = { (uint8_t *)Open_Sans_SemiBold_24Bitmaps,(GFXglyph *)Open_Sans_SemiBold_24Glyphs,0x20, 0x7E, 33};
petus/ESP32_SCD41_CozIR-LP_SHT40_ePaper-home-monitor
OpenSansSB_12px.h
<gh_stars>0 // Created by http://oleddisplay.squix.ch/ Consider a donation // In case of problems make sure that you are using the font file with the correct version! const uint8_t Open_Sans_SemiBold_12Bitmaps[] PROGMEM = { // Bitmap Data: 0x00, // ' ' 0xAA,0xA2,0x80, // '!' 0xAA,0xA0, // '"' 0x12,0x0A,0x05,0x0F,0xE2,0x47,0xF0,0xA0,0x50,0x48,0x00, // '#' 0x21,0xEA,0x38,0x70,0xE2,0xBC,0x20, // '$' 0x63,0x0A,0x43,0x58,0x6A,0xC5,0xE8,0xD5,0x86,0xB0,0x94,0x31,0x80, // '%' 0x70,0x64,0x32,0x0A,0x06,0x34,0x92,0x39,0x18,0x7A,0x00, // '&' 0xA8, // ''' 0x4C,0x88,0x88,0x88,0x8C,0x40, // '(' 0x43,0x08,0x42,0x10,0x84,0x23,0x10, // ')' 0x10,0x10,0x7C,0x10,0x28,0x28, // '*' 0x20,0x8F,0x88,0x20, // '+' 0x4B,0x00, // ',' 0xF0, // '-' 0xA0, // '.' 0x18,0x41,0x0C,0x21,0x84,0x10,0xC0, // '/' 0x72,0x28,0xA2,0x8A,0x28,0xA2,0x70, // '0' 0x33,0xAC,0x63,0x18,0xC6,0x30, // '1' 0xF2,0x20,0x82,0x10,0xC6,0x30,0xF8, // '2' 0xF2,0x20,0x86,0x70,0x20,0x82,0xF0, // '3' 0x0C,0x1C,0x1C,0x2C,0x4C,0x4C,0xFE,0x0C,0x0C, // '4' 0xFA,0x08,0x3C,0x18,0x20,0x86,0xF0, // '5' 0x39,0x82,0x07,0xC8,0x91,0xA2,0x64,0x70, // '6' 0xFE,0x04,0x0C,0x08,0x18,0x18,0x10,0x30,0x20, // '7' 0x72,0x28,0xB6,0x73,0x68,0xA2,0xF8, // '8' 0x72,0x68,0xA2,0x8B,0xE0,0x86,0xF0, // '9' 0xA0,0xA0, // ':' 0x48,0x00,0x96, // ';' 0x08,0xEC,0x30,0x38,0x20, // '<' 0xF8,0x0F,0x80, // '=' 0x83,0x81,0x86,0xE2,0x00, // '>' 0xF0,0x61,0x84,0x20,0x80,0x18,0x60, // '?' 0x3E,0x18,0x4D,0xEA,0xCA,0xA2,0xA8,0xAA,0x6A,0x6C,0x40,0x0F,0x80, // '@' 0x18,0x0C,0x0F,0x04,0x82,0x43,0xF1,0x08,0x84,0xC3,0x00, // 'A' 0xF9,0x9B,0x16,0x6F,0x98,0xB1,0x62,0xF8, // 'B' 0x3E,0x40,0xC0,0x80,0x80,0x80,0xC0,0x40,0x3C, // 'C' 0xF8,0xC4,0xC6,0xC2,0xC2,0xC2,0xC6,0xC4,0xF8, // 'D' 0xFB,0x0C,0x30,0xFB,0x0C,0x30,0xF8, // 'E' 0xFA,0x08,0x20,0xF2,0x08,0x20,0x80, // 'F' 0x3E,0x60,0xC0,0x80,0x8E,0x82,0xC2,0x42,0x3E, // 'G' 0xC6,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6, // 'H' 0xDB,0x6D,0xB6,0xC0, // 'I' 0x31,0x8C,0x63,0x18,0xC6,0x31,0x38, // 'J' 0xC4,0xCC,0xD8,0xF0,0xF0,0xD8,0xC8,0xCC,0xC6, // 'K' 0xC1,0x83,0x06,0x0C,0x18,0x30,0x60,0xFC, // 'L' 0xC1,0xB8,0xEA,0x2A,0x8A,0xB6,0xA5,0x29,0x4A,0x72,0x88,0x80, // 'M' 0xC2,0xE2,0xA2,0xB2,0x92,0x9A,0x8A,0x8E,0x86, // 'N' 0x7C,0xC6,0x82,0x82,0x82,0x82,0x82,0xC6,0x7C, // 'O' 0xFA,0x28,0xA2,0xF2,0x08,0x20,0x80, // 'P' 0x7C,0xC6,0x82,0x82,0x82,0x82,0x82,0xC6,0x7C,0x0C,0x06, // 'Q' 0xF8,0xCC,0xC4,0xCC,0xF8,0xD8,0xC8,0xCC,0xC6, // 'R' 0x7A,0x08,0x30,0x70,0x60,0x82,0xF0, // 'S' 0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, // 'T' 0x82,0x82,0x82,0x82,0x82,0x82,0xC6,0xC4,0x7C, // 'U' 0xC6,0xC6,0x44,0x44,0x6C,0x28,0x28,0x28,0x10, // 'V' 0xC4,0x6C,0xE6,0x4A,0x44,0xA4,0x4A,0x47,0xBC,0x31,0x83,0x18,0x31,0x80, // 'W' 0xC4,0x6C,0x28,0x38,0x10,0x28,0x6C,0x44,0xC6, // 'X' 0xC6,0x44,0x6C,0x28,0x38,0x10,0x10,0x10,0x10, // 'Y' 0x7C,0x0C,0x08,0x18,0x10,0x30,0x60,0x40,0xFE, // 'Z' 0xE8,0x88,0x88,0x88,0x88,0xE0, // '[' 0xC1,0x04,0x18,0x20,0xC1,0x04,0x18, // '\' 0xE2,0x22,0x22,0x22,0x22,0xE0, // ']' 0x20,0x61,0x62,0x48,0xC0, // '^' 0xF8, // '_' 0xC6, // '`' 0xF0,0x2F,0xA2,0x9B,0xA0, // 'a' 0x82,0x08,0x2E,0xCA,0x28,0xB2,0xB8, // 'b' 0x7A,0x08,0x20,0x81,0xC0, // 'c' 0x08,0x20,0xBA,0x9A,0x28,0xA6,0xE8, // 'd' 0x72,0x2F,0xA0,0xC1,0xE0, // 'e' 0x39,0x86,0x3C,0x61,0x86,0x18,0x60, // 'f' 0x7E,0x44,0x44,0x78,0x40,0x7C,0xC6,0x86,0x7C, // 'g' 0x81,0x02,0x05,0xCC,0xD0,0xA1,0x42,0x84, // 'h' 0xA2,0xAA,0x80, // 'i' 0x22,0x02,0x22,0x22,0x22,0x2E, // 'j' 0x81,0x02,0x04,0x49,0x14,0x3C,0x4C,0x8C, // 'k' 0xAA,0xAA,0x80, // 'l' 0xBF,0xB3,0x28,0x8A,0x22,0x88,0xA2,0x20, // 'm' 0xB9,0x9A,0x14,0x28,0x50,0x80, // 'n' 0x72,0x28,0xA2,0x89,0xC0, // 'o' 0xBB,0x28,0xA2,0xCA,0xE8,0x20,0x80, // 'p' 0xEA,0x68,0xA2,0x9B,0xA0,0x82,0x08, // 'q' 0xB6,0x21,0x08,0x40, // 'r' 0xF4,0x38,0x61,0x78, // 's' 0x63,0xE6,0x18,0x61,0x83,0x80, // 't' 0x85,0x0A,0x14,0x2C,0xCE,0x80, // 'u' 0xCC,0x91,0x23,0xC3,0x06,0x00, // 'v' 0xCC,0xC9,0x91,0x7A,0x39,0xC3,0x30,0x66,0x00, // 'w' 0x44,0x6C,0x38,0x38,0x6C,0x44, // 'x' 0xCC,0x91,0x23,0xC3,0x06,0x0C,0x10,0xE0, // 'y' 0x78,0x30,0x41,0x04,0x1F,0x80, // 'z' 0x18,0x82,0x08,0x23,0x02,0x08,0x20,0x81,0x80, // '{' 0xAA,0xAA,0xAA, // '|' 0xC2,0x10,0x86,0x19,0x88,0x42,0x30 // '}' }; const GFXglyph Open_Sans_SemiBold_12Glyphs[] PROGMEM = { // bitmapOffset, width, height, xAdvance, xOffset, yOffset { 0, 1, 1, 4, 0, 0 }, // ' ' { 1, 2, 9, 4, 1, -9 }, // '!' { 4, 4, 3, 6, 1, -9 }, // '"' { 6, 9, 9, 9, 0, -9 }, // '#' { 17, 6, 9, 8, 1, -9 }, // '$' { 24, 11, 9, 11, 0, -9 }, // '%' { 37, 9, 9, 10, 1, -9 }, // '&' { 48, 2, 3, 4, 1, -9 }, // ''' { 49, 4, 11, 5, 1, -9 }, // '(' { 55, 5, 11, 5, 0, -9 }, // ')' { 62, 8, 6, 8, 0, -9 }, // '*' { 68, 6, 5, 8, 1, -7 }, // '+' { 72, 3, 3, 4, 0, -1 }, // ',' { 74, 5, 1, 5, 0, -4 }, // '-' { 75, 2, 2, 4, 1, -2 }, // '.' { 76, 6, 9, 6, 0, -9 }, // '/' { 83, 6, 9, 8, 1, -9 }, // '0' { 90, 5, 9, 8, 1, -9 }, // '1' { 96, 6, 9, 8, 1, -9 }, // '2' { 103, 6, 9, 8, 1, -9 }, // '3' { 110, 8, 9, 8, 0, -9 }, // '4' { 119, 6, 9, 8, 1, -9 }, // '5' { 126, 7, 9, 8, 1, -9 }, // '6' { 134, 8, 9, 8, 0, -9 }, // '7' { 143, 6, 9, 8, 1, -9 }, // '8' { 150, 6, 9, 8, 1, -9 }, // '9' { 157, 2, 6, 4, 1, -6 }, // ':' { 159, 3, 8, 4, 0, -6 }, // ';' { 162, 6, 6, 8, 1, -8 }, // '<' { 167, 6, 3, 8, 1, -6 }, // '=' { 170, 6, 6, 8, 1, -8 }, // '>' { 175, 6, 9, 6, 0, -9 }, // '?' { 182, 10, 10, 12, 1, -9 }, // '@' { 195, 9, 9, 9, 0, -9 }, // 'A' { 206, 7, 9, 9, 1, -9 }, // 'B' { 214, 8, 9, 9, 1, -9 }, // 'C' { 223, 8, 9, 10, 1, -9 }, // 'D' { 232, 6, 9, 8, 1, -9 }, // 'E' { 239, 6, 9, 7, 1, -9 }, // 'F' { 246, 8, 9, 10, 1, -9 }, // 'G' { 255, 8, 9, 10, 1, -9 }, // 'H' { 264, 3, 9, 5, 1, -9 }, // 'I' { 268, 5, 11, 5, -1, -9 }, // 'J' { 275, 8, 9, 9, 1, -9 }, // 'K' { 284, 7, 9, 8, 1, -9 }, // 'L' { 292, 10, 9, 12, 1, -9 }, // 'M' { 304, 8, 9, 10, 1, -9 }, // 'N' { 313, 8, 9, 10, 1, -9 }, // 'O' { 322, 6, 9, 8, 1, -9 }, // 'P' { 329, 8, 11, 10, 1, -9 }, // 'Q' { 340, 8, 9, 9, 1, -9 }, // 'R' { 349, 6, 9, 8, 1, -9 }, // 'S' { 356, 8, 9, 8, 0, -9 }, // 'T' { 365, 8, 9, 10, 1, -9 }, // 'U' { 374, 8, 9, 8, 0, -9 }, // 'V' { 383, 12, 9, 12, 0, -9 }, // 'W' { 397, 8, 9, 8, 0, -9 }, // 'X' { 406, 8, 9, 8, 0, -9 }, // 'Y' { 415, 8, 9, 8, 0, -9 }, // 'Z' { 424, 4, 11, 5, 1, -9 }, // '[' { 430, 6, 9, 6, 0, -9 }, // '\' { 437, 4, 11, 5, 0, -9 }, // ']' { 443, 7, 5, 7, 0, -9 }, // '^' { 448, 6, 1, 6, 0, 1 }, // '_' { 449, 4, 2, 8, 2, -9 }, // '`' { 450, 6, 6, 8, 1, -6 }, // 'a' { 455, 6, 9, 8, 1, -9 }, // 'b' { 462, 6, 6, 7, 1, -6 }, // 'c' { 467, 6, 9, 8, 1, -9 }, // 'd' { 474, 6, 6, 8, 1, -6 }, // 'e' { 479, 6, 9, 5, 0, -9 }, // 'f' { 486, 8, 9, 8, 0, -6 }, // 'g' { 495, 7, 9, 9, 1, -9 }, // 'h' { 503, 2, 9, 4, 1, -9 }, // 'i' { 506, 4, 12, 4, -1, -9 }, // 'j' { 512, 7, 9, 8, 1, -9 }, // 'k' { 520, 2, 9, 4, 1, -9 }, // 'l' { 523, 10, 6, 12, 1, -6 }, // 'm' { 531, 7, 6, 9, 1, -6 }, // 'n' { 537, 6, 6, 8, 1, -6 }, // 'o' { 542, 6, 9, 8, 1, -6 }, // 'p' { 549, 6, 9, 8, 1, -6 }, // 'q' { 556, 5, 6, 6, 1, -6 }, // 'r' { 560, 5, 6, 7, 1, -6 }, // 's' { 564, 6, 7, 6, 0, -7 }, // 't' { 570, 7, 6, 9, 1, -6 }, // 'u' { 576, 7, 6, 7, 0, -6 }, // 'v' { 582, 11, 6, 11, 0, -6 }, // 'w' { 591, 8, 6, 8, 0, -6 }, // 'x' { 597, 7, 9, 7, 0, -6 }, // 'y' { 605, 7, 6, 7, 0, -6 }, // 'z' { 611, 6, 11, 6, 0, -9 }, // '{' { 620, 2, 12, 8, 3, -9 }, // '|' { 623, 5, 11, 5, 0, -9 } // '}' }; const GFXfont OpenSansSB_12px PROGMEM = { (uint8_t *)Open_Sans_SemiBold_12Bitmaps,(GFXglyph *)Open_Sans_SemiBold_12Glyphs,0x20, 0x7E, 17};
petus/ESP32_SCD41_CozIR-LP_SHT40_ePaper-home-monitor
OpenSansSB_16px.h
// Created by http://oleddisplay.squix.ch/ Consider a donation // In case of problems make sure that you are using the font file with the correct version! const uint8_t Open_Sans_SemiBold_16Bitmaps[] PROGMEM = { // Bitmap Data: 0x00, // ' ' 0xDB,0x6D,0xB6,0x03,0x60, // '!' 0xDB,0x6D,0xB6, // '"' 0x09,0x03,0x20,0x6C,0x3F,0xE1,0x20,0x24,0x04,0x87,0xFC,0x36,0x04,0xC0,0x90,0x12,0x00, // '#' 0x10,0x10,0x7C,0xFE,0xD0,0xD0,0x78,0x3C,0x16,0x96,0xFE,0xFC,0x10,0x10, // '$' 0x70,0xC6,0x84,0x26,0x61,0x32,0x09,0xB0,0x69,0x71,0xD2,0xC1,0xB2,0x09,0x90,0xCC,0x84,0x2C,0x61,0xC0, // '%' 0x3C,0x07,0xE0,0x66,0x06,0x60,0x6C,0x03,0x80,0x78,0xCC,0xCC,0xC7,0x8C,0x38,0xFF,0x87,0xCC, // '&' 0xDB,0x60, // ''' 0x23,0x11,0x8C,0x42,0x10,0x84,0x31,0x84,0x30,0x80, // '(' 0x43,0x08,0x63,0x08,0x42,0x10,0x8C,0x62,0x31,0x00, // ')' 0x10,0x10,0xD6,0xFE,0x38,0x6C,0x44, // '*' 0x10,0x10,0x10,0xFE,0x10,0x10,0x10, // '+' 0x66,0x44, // ',' 0xEE, // '-' 0xD8, // '.' 0x0C,0x10,0x60,0xC1,0x06,0x0C,0x10,0x60,0xC1,0x06,0x00, // '/' 0x38,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x38, // '0' 0x18,0xEF,0x96,0x18,0x61,0x86,0x18,0x61,0x86, // '1' 0x7C,0xFE,0xC6,0x06,0x06,0x0C,0x08,0x10,0x20,0xC0,0xFE,0xFE, // '2' 0x7C,0xFE,0x86,0x06,0x04,0x78,0x7C,0x06,0x06,0x06,0xFE,0xF8, // '3' 0x06,0x03,0x80,0xE0,0x78,0x16,0x0D,0x86,0x61,0x18,0xFF,0xBF,0xE0,0x60,0x18, // '4' 0x7C,0xFC,0xC0,0xC0,0xFC,0xFE,0x06,0x06,0x06,0x06,0xFC,0xF8, // '5' 0x1E,0x7E,0x60,0xC0,0xFC,0xFE,0xC6,0xC2,0xC2,0xC6,0x7E,0x3C, // '6' 0xFE,0xFE,0x06,0x04,0x0C,0x0C,0x18,0x18,0x10,0x30,0x30,0x60, // '7' 0x7C,0xFE,0xC6,0xC6,0x64,0x38,0x7C,0xC6,0x82,0xC6,0xFE,0x7C, // '8' 0x78,0xFC,0xC6,0xC6,0x86,0xC6,0xFE,0x7E,0x06,0x0C,0xFC,0xF0, // '9' 0xD8,0x00,0x06,0xC0, // ':' 0x66,0x00,0x00,0x06,0x64,0x40, // ';' 0x02,0x0E,0x38,0xE0,0xC0,0x38,0x0E,0x02, // '<' 0xFE,0x00,0x00,0x00,0xFE, // '=' 0x80,0xE0,0x38,0x0E,0x06,0x38,0xE0,0x80, // '>' 0x78,0xFC,0x06,0x06,0x0C,0x18,0x30,0x30,0x00,0x00,0x30,0x30, // '?' 0x0F,0x81,0xC6,0x18,0x08,0x9F,0x6D,0x99,0x4C,0xCA,0x46,0x52,0x32,0x99,0xB6,0x77,0x10,0x00,0x61,0x01,0xF8,0x00, // '@' 0x0E,0x00,0xE0,0x0A,0x01,0xB0,0x1B,0x03,0x18,0x31,0x83,0xF8,0x7F,0xC6,0x0C,0x60,0xCC,0x06, // 'A' 0xFC,0x7F,0x21,0xD0,0x68,0x67,0xF3,0xF9,0x06,0x83,0x41,0xBF,0xDF,0x80, // 'B' 0x1F,0x3F,0x98,0x5C,0x0C,0x06,0x03,0x01,0x80,0xC0,0x30,0x1F,0xC3,0xE0, // 'C' 0xFC,0x3F,0x88,0x72,0x0E,0x81,0xA0,0x68,0x1A,0x06,0x83,0xA1,0xCF,0xE3,0xF0, // 'D' 0xFD,0xFA,0x04,0x08,0x1F,0xBF,0x40,0x81,0x03,0xF7,0xE0, // 'E' 0xFD,0xFA,0x04,0x08,0x1F,0xBF,0x40,0x81,0x02,0x04,0x00, // 'F' 0x1F,0x87,0xF1,0xC0,0x70,0x0C,0x01,0x80,0x31,0xF6,0x3E,0xE0,0xCE,0x19,0xFF,0x0F,0xC0, // 'G' 0x81,0xA0,0x68,0x1A,0x06,0x81,0xBF,0xEF,0xFA,0x06,0x81,0xA0,0x68,0x1A,0x06, // 'H' 0xAA,0xAA,0xAA, // 'I' 0x10,0x84,0x21,0x08,0x42,0x10,0x84,0x63,0x7B,0x80, // 'J' 0xC3,0x30,0xCC,0x63,0x30,0xD8,0x36,0x0F,0x83,0x30,0xC6,0x31,0x8C,0x33,0x06, // 'K' 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0xFE, // 'L' 0xC0,0x6E,0x0E,0xE0,0xEA,0x0A,0xB1,0xAB,0x12,0x91,0x29,0xB2,0x9A,0x28,0xE2,0x8E,0x28,0xC2, // 'M' 0xC0,0xB8,0x2E,0x0A,0xC2,0xB8,0xA6,0x28,0xCA,0x3A,0x86,0xA0,0xE8,0x3A,0x06, // 'N' 0x1F,0x07,0xFC,0x60,0xCE,0x06,0xC0,0x6C,0x06,0xC0,0x6C,0x06,0xE0,0x66,0x0C,0x7F,0xC1,0xF0, // 'O' 0xF8,0xFE,0x86,0x86,0x86,0x86,0xFC,0xF8,0x80,0x80,0x80,0x80, // 'P' 0x1F,0x07,0xFC,0x60,0xCE,0x06,0xC0,0x6C,0x06,0xC0,0x6C,0x06,0xE0,0x66,0x0C,0x7F,0x81,0xF0,0x03,0x80,0x18,0x00,0xC0, // 'Q' 0xFC,0x3F,0x8C,0x73,0x0C,0xC3,0x31,0xCF,0xE3,0xF0,0xCC,0x31,0x8C,0x33,0x0E, // 'R' 0x7C,0xFE,0xC2,0xC0,0xE0,0x78,0x1C,0x06,0x06,0x86,0xFE,0xFC, // 'S' 0xFF,0xBF,0xE0,0x80,0x20,0x08,0x02,0x00,0x80,0x20,0x08,0x02,0x00,0x80,0x20, // 'T' 0xC0,0xD8,0x1B,0x03,0x60,0x6C,0x0D,0x81,0xB0,0x36,0x06,0xC0,0xCC,0x31,0xFE,0x0F,0x00, // 'U' 0xC0,0xD8,0x11,0x86,0x30,0xC6,0x10,0x66,0x0C,0xC1,0x90,0x1E,0x03,0xC0,0x70,0x06,0x00, // 'V' 0xC3,0x86,0xC3,0x86,0x63,0x8C,0x62,0x8C,0x66,0xCC,0x66,0xCC,0x24,0xC8,0x34,0x58,0x3C,0x78,0x3C,0x78,0x18,0x30,0x18,0x30, // 'W' 0x61,0x8C,0x30,0xCC,0x19,0x81,0xE0,0x18,0x07,0x80,0xF0,0x33,0x06,0x61,0x86,0x60,0x60, // 'X' 0xC1,0x98,0xC6,0x30,0xD8,0x36,0x07,0x01,0xC0,0x20,0x08,0x02,0x00,0x80,0x20, // 'Y' 0xFE,0x7F,0x01,0x81,0x81,0x80,0xC0,0xC0,0xC0,0x60,0x60,0x3F,0xDF,0xE0, // 'Z' 0xF6,0x31,0x8C,0x63,0x18,0xC6,0x31,0x8C,0x63,0xC0, // '[' 0xC0,0x81,0x83,0x02,0x06,0x0C,0x08,0x18,0x30,0x20,0x60, // '\' 0xF1,0x8C,0x63,0x18,0xC6,0x31,0x8C,0x63,0x1B,0xC0, // ']' 0x08,0x07,0x01,0x40,0x98,0x22,0x10,0xCC,0x10, // '^' 0xFE, // '_' 0xC4,0x20, // '`' 0x7C,0x7E,0x06,0x06,0x7E,0xC6,0xC6,0xFE,0x76, // 'a' 0xC0,0x60,0x30,0x18,0x0D,0xE7,0xF3,0x8D,0x86,0xC3,0x61,0xB8,0xDF,0xCD,0xE0, // 'b' 0x3C,0xFB,0x06,0x0C,0x18,0x30,0x3E,0x3C, // 'c' 0x03,0x01,0x80,0xC0,0x67,0xB3,0xFB,0x1D,0x86,0xC3,0x61,0xB1,0xDF,0xE7,0xB0, // 'd' 0x3C,0x7E,0xC6,0xFE,0xFE,0xC0,0xC0,0x7E,0x3C, // 'e' 0x1E,0x3C,0x30,0x30,0x7C,0xFC,0x30,0x30,0x30,0x30,0x30,0x30,0x30, // 'f' 0x3F,0x99,0x86,0x31,0x8C,0x62,0x0F,0x06,0x01,0xFC,0x7F,0x30,0x6C,0x1B,0x0C,0x7E,0x00, // 'g' 0xC0,0x60,0x30,0x18,0x0D,0xE7,0xF3,0x8D,0x86,0xC3,0x61,0xB0,0xD8,0x6C,0x30, // 'h' 0xD8,0x0D,0xB6,0xDB,0x6C, // 'i' 0x31,0x80,0x03,0x18,0xC6,0x31,0x8C,0x63,0x18,0xDE,0xE0, // 'j' 0xC0,0x60,0x30,0x18,0x0C,0x66,0x63,0x61,0xB0,0xF8,0x7C,0x33,0x18,0xCC,0x70, // 'k' 0xDB,0x6D,0xB6,0xDB,0x6C, // 'l' 0xDC,0xF3,0xFF,0xEE,0x71,0xB0,0xC6,0xC2,0x1B,0x08,0x6C,0x21,0xB0,0x86,0xC2,0x18, // 'm' 0xDE,0x7F,0x38,0xD8,0x6C,0x36,0x1B,0x0D,0x86,0xC3,0x00, // 'n' 0x3C,0x3F,0x30,0xD8,0x6C,0x36,0x1B,0x0C,0xFC,0x3C,0x00, // 'o' 0xDE,0x7F,0x38,0xD8,0x6C,0x36,0x1B,0x8D,0xFC,0xDE,0x60,0x30,0x18,0x0C,0x00, // 'p' 0x7B,0x3F,0xB1,0xD8,0x6C,0x36,0x1B,0x1D,0xFE,0x7B,0x01,0x80,0xC0,0x60,0x30, // 'q' 0xDD,0xFB,0x86,0x0C,0x18,0x30,0x60,0xC0, // 'r' 0x79,0xFB,0x17,0x07,0x81,0x83,0x7E,0xF8, // 's' 0x20,0x41,0xF7,0xE6,0x0C,0x18,0x30,0x60,0x78,0xF0, // 't' 0xC3,0x61,0xB0,0xD8,0x6C,0x36,0x1B,0x1C,0xFE,0x7B,0x00, // 'u' 0xC1,0x90,0xC6,0x31,0x8C,0x36,0x0D,0x81,0x40,0x70,0x1C,0x00, // 'v' 0xC7,0x19,0x1C,0x46,0x53,0x19,0x4C,0x6D,0xB0,0xB6,0x83,0x8E,0x0E,0x38,0x38,0xE0, // 'w' 0x63,0x18,0xC3,0x60,0x70,0x1C,0x07,0x03,0x61,0x8C,0x63,0x00, // 'x' 0xC1,0x98,0xC6,0x31,0x8C,0x36,0x0D,0x81,0x60,0x70,0x1C,0x06,0x01,0x83,0xC0,0xE0,0x00, // 'y' 0xFD,0xF8,0x30,0xC3,0x0C,0x30,0x7E,0xFC, // 'z' 0x1C,0x70,0xC1,0x83,0x06,0x38,0x38,0x30,0x60,0xC1,0x83,0x03,0x07,0x00, // '{' 0xAA,0xAA,0xAA,0xAA,0x80, // '|' 0xE0,0xE0,0xC1,0x83,0x06,0x07,0x1C,0x30,0x60,0xC1,0x83,0x0C,0x38,0x00 // '}' }; const GFXglyph Open_Sans_SemiBold_16Glyphs[] PROGMEM = { // bitmapOffset, width, height, xAdvance, xOffset, yOffset { 0, 1, 1, 5, 0, 0 }, // ' ' { 1, 3, 12, 5, 1, -12 }, // '!' { 6, 6, 4, 8, 1, -12 }, // '"' { 9, 11, 12, 11, 0, -12 }, // '#' { 26, 8, 14, 10, 1, -13 }, // '$' { 40, 13, 12, 15, 1, -12 }, // '%' { 60, 12, 12, 13, 1, -12 }, // '&' { 78, 3, 4, 5, 1, -12 }, // ''' { 80, 5, 15, 6, 1, -12 }, // '(' { 90, 5, 15, 6, 0, -12 }, // ')' { 100, 8, 7, 10, 1, -13 }, // '*' { 107, 8, 7, 10, 1, -9 }, // '+' { 114, 4, 4, 5, 0, -2 }, // ',' { 116, 4, 2, 6, 1, -5 }, // '-' { 117, 3, 2, 5, 1, -2 }, // '.' { 118, 7, 12, 7, 0, -12 }, // '/' { 129, 8, 12, 10, 1, -12 }, // '0' { 141, 6, 12, 10, 1, -12 }, // '1' { 150, 8, 12, 10, 1, -12 }, // '2' { 162, 8, 12, 10, 1, -12 }, // '3' { 174, 10, 12, 10, 0, -12 }, // '4' { 189, 8, 12, 10, 1, -12 }, // '5' { 201, 8, 12, 10, 1, -12 }, // '6' { 213, 8, 12, 10, 1, -12 }, // '7' { 225, 8, 12, 10, 1, -12 }, // '8' { 237, 8, 12, 10, 1, -12 }, // '9' { 249, 3, 9, 5, 1, -9 }, // ':' { 253, 4, 11, 5, 0, -9 }, // ';' { 259, 8, 8, 10, 1, -10 }, // '<' { 267, 8, 5, 10, 1, -8 }, // '=' { 272, 8, 8, 10, 1, -10 }, // '>' { 280, 8, 12, 8, 0, -12 }, // '?' { 292, 13, 13, 15, 1, -12 }, // '@' { 314, 12, 12, 12, 0, -12 }, // 'A' { 332, 9, 12, 12, 2, -12 }, // 'B' { 346, 9, 12, 11, 1, -12 }, // 'C' { 360, 10, 12, 13, 2, -12 }, // 'D' { 375, 7, 12, 10, 2, -12 }, // 'E' { 386, 7, 12, 10, 2, -12 }, // 'F' { 397, 11, 12, 13, 1, -12 }, // 'G' { 414, 10, 12, 13, 2, -12 }, // 'H' { 429, 2, 12, 6, 2, -12 }, // 'I' { 432, 5, 15, 6, -1, -12 }, // 'J' { 442, 10, 12, 11, 1, -12 }, // 'K' { 457, 8, 12, 10, 2, -12 }, // 'L' { 469, 12, 12, 16, 2, -12 }, // 'M' { 487, 10, 12, 14, 2, -12 }, // 'N' { 502, 12, 12, 14, 1, -12 }, // 'O' { 520, 8, 12, 11, 2, -12 }, // 'P' { 532, 12, 15, 14, 1, -12 }, // 'Q' { 555, 10, 12, 11, 1, -12 }, // 'R' { 570, 8, 12, 10, 1, -12 }, // 'S' { 582, 10, 12, 10, 0, -12 }, // 'T' { 597, 11, 12, 13, 1, -12 }, // 'U' { 614, 11, 12, 11, 0, -12 }, // 'V' { 631, 16, 12, 16, 0, -12 }, // 'W' { 655, 11, 12, 11, 0, -12 }, // 'X' { 672, 10, 12, 10, 0, -12 }, // 'Y' { 687, 9, 12, 10, 1, -12 }, // 'Z' { 701, 5, 15, 6, 1, -12 }, // '[' { 711, 7, 12, 7, 0, -12 }, // '\' { 722, 5, 15, 6, 0, -12 }, // ']' { 732, 10, 7, 10, 0, -12 }, // '^' { 741, 8, 1, 8, 0, 1 }, // '_' { 742, 4, 3, 10, 3, -13 }, // '`' { 744, 8, 9, 10, 1, -9 }, // 'a' { 753, 9, 13, 11, 1, -13 }, // 'b' { 768, 7, 9, 9, 1, -9 }, // 'c' { 776, 9, 13, 11, 1, -13 }, // 'd' { 791, 8, 9, 10, 1, -9 }, // 'e' { 800, 8, 13, 7, 0, -13 }, // 'f' { 813, 10, 13, 10, 0, -9 }, // 'g' { 830, 9, 13, 11, 1, -13 }, // 'h' { 845, 3, 13, 5, 1, -13 }, // 'i' { 850, 5, 17, 5, -1, -13 }, // 'j' { 861, 9, 13, 10, 1, -13 }, // 'k' { 876, 3, 13, 5, 1, -13 }, // 'l' { 881, 14, 9, 16, 1, -9 }, // 'm' { 897, 9, 9, 11, 1, -9 }, // 'n' { 908, 9, 9, 11, 1, -9 }, // 'o' { 919, 9, 13, 11, 1, -9 }, // 'p' { 934, 9, 13, 11, 1, -9 }, // 'q' { 949, 7, 9, 8, 1, -9 }, // 'r' { 957, 7, 9, 9, 1, -9 }, // 's' { 965, 7, 11, 7, 0, -11 }, // 't' { 975, 9, 9, 11, 1, -9 }, // 'u' { 986, 10, 9, 10, 0, -9 }, // 'v' { 998, 14, 9, 14, 0, -9 }, // 'w' { 1014, 10, 9, 10, 0, -9 }, // 'x' { 1026, 10, 13, 10, 0, -9 }, // 'y' { 1043, 7, 9, 9, 1, -9 }, // 'z' { 1051, 7, 15, 7, 0, -12 }, // '{' { 1065, 2, 17, 10, 4, -13 }, // '|' { 1070, 7, 15, 7, 0, -12 } // '}' }; const GFXfont OpenSansSB_16px PROGMEM = { (uint8_t *)Open_Sans_SemiBold_16Bitmaps,(GFXglyph *)Open_Sans_SemiBold_16Glyphs,0x20, 0x7E, 23};
supermanbirdy/supermanbirdy.github.io
node_modules/iltorb/src/_iltorb.h
/* empty file for main module */
supermanbirdy/supermanbirdy.github.io
node_modules/iltorb/src/_memcpy.h
<reponame>supermanbirdy/supermanbirdy.github.io /* force mempcy to be from earlier compatible system */ /* see https://github.com/MayhemYDG/iltorb/issues/35 */ /* https://github.com/MayhemYDG/iltorb/issues/39 */ /* https://github.com/MayhemYDG/iltorb/issues/40 */ #if defined(__linux__) && defined(__GLIBC__) && defined(__x86_64__) __asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); #endif
Mason-Edwards/C-File-Transfer
server.c
/* Server demo */ #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/types.h> #include <netdb.h> #include <netinet/in.h> #include <string.h> #include <pthread.h> #include <stdbool.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include "socketinfo.h" #include "utils.h" // Function declarations void* handle_connection(void* pclient_socket); void* io_handler(); void login(int client_socket); void displayUsers(int client_socket); void uploadFile(int client_socket); void downloadFile(int client_socket); void shareFile(int client_socket); //Structs typedef struct client { int fd; char name[MSGSIZE]; bool isConnected; } Client; typedef struct clientPerms { char name[MSGSIZE]; char perms[5]; } ClientPerms; typedef struct file { char filename[FILE_NAME_SIZE]; char owner[30]; int numShared; ClientPerms shared[MAXUSERS]; } File; // Array of users connected Client users[MAXUSERS] = {0}; // Files Uploaded File files[100] = {0}; int numUsers = 0; int numFiles = 0; const char menu[] = "1. Upload File\n2. Download File\n3. Share File\n4.Exit\n"; int server_socket; // Mutex Locks pthread_mutex_t usersLock = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t filesLock = PTHREAD_MUTEX_INITIALIZER; int main () { // Set up the socket server_socket= socket (AF_INET, SOCK_STREAM, 0); struct sockaddr_in server_address; server_address.sin_family= AF_INET; server_address.sin_port= htons(PORT); server_address.sin_addr.s_addr= INADDR_ANY; bind(server_socket, (struct sockaddr*) &server_address, sizeof(server_address)); // Create thread of handling user input pthread_t io; pthread_create(&io, NULL, io_handler, NULL); // Start Listening listen(server_socket,BACKLOG); printf("Waiting for connections...\n"); while(1) { int client_socket; // Accept blocks if listen backlog is empty client_socket=accept(server_socket,NULL,NULL); // Fork or create thread to handle connection. pthread_t t; // pthread_create passes an argument as a pointer // so create a pointer for the client_socket int *pclient_socket = malloc(sizeof(int)); *pclient_socket = client_socket; pthread_create(&t, NULL, handle_connection, pclient_socket); } printf("\nCLOSING SERVER"); close(server_socket); return EXIT_SUCCESS; } // the start routine of pthread_create has to return a void pointer void* handle_connection(void *pclient_socket) { // Since pclient_socket is a void pointer we need to cast it to // an int before we can dereference it. int client_socket = *((int*)pclient_socket); // Free the pointer because it isnt needed free(pclient_socket); // Infinitely loop to handle specific conenction. while(1) { // Recieve a message and store it into msg char msg[MSGSIZE]; recv(client_socket, msg, sizeof(msg), 0); // If the user just connected for the first time if(strcmp(msg, "successfulConnection") == 0) { login(client_socket); } // If the user has selected "Upload File" else if (strcmp(msg, "1") == 0) { uploadFile(client_socket); } // If the user wants to download file else if (strcmp(msg, "2") == 0) { downloadFile(client_socket); } // If the user wants to share a file else if (strcmp(msg, "3") == 0) { if(numFiles == 0) { send(client_socket, "No files on server...\n", 24, 0); } else shareFile(client_socket); } // If the user has selected "Exit" else if (strcmp(msg, "4") == 0) { send(client_socket, "EXITING", 8, 0); for(int i = 0; i < numUsers; i++) { if(users[i].fd == client_socket) { users[i].isConnected = 0; printf("User has disconnected: %s\n\n", users[i].name); break; } } close(client_socket); break; } } } void login(int client_socket) { char userName[MSGSIZE] = {0}; const char loginMsg[] = "Welcome!\nPlease enter login info: "; char confirm[MSGSIZE] = {0}; // Send the user the login message send(client_socket, loginMsg, sizeof(loginMsg), 0); newusername: // Recieve the users login name recv(client_socket, userName, sizeof(userName), 0); // If the login name is taken, ask for new one for(int i = 0; i < numUsers; i++) { if(strcmp(users[i].name, userName) == 0) { send(client_socket, "NEWUSERNAME", 12, 0); goto newusername; } } // Store the clients file descriptor and name // then add it to the users array Client client; client.fd = client_socket; client.isConnected = 1; strcpy(client.name, userName); pthread_mutex_lock(&usersLock); users[numUsers] = client; numUsers++; pthread_mutex_unlock(&usersLock); // Print logged in user on server printf("User Logged in: %s\n\n", userName); snprintf(confirm, sizeof confirm, "\nLogged in as %s!\n\n%s", userName, menu); // Send user logged in confirmation and menu send(client_socket, confirm, sizeof confirm, 0); } void uploadFile(int client_socket) { printf("-----Uploading File-----\n"); char* initMsg = "UPLOAD"; char filename[FILE_NAME_SIZE] = {0}; int response; int bs = send(client_socket, initMsg, sizeof(initMsg), 0); start: // Get the filename recv(client_socket, filename, sizeof filename, 0); // Check if the file already exists if(fopen(filename, "r") != NULL) { send(client_socket, "FILEEXISTS", 11, 0); memset(filename, 0, sizeof filename); goto start; } // After first goto it doesnt block on recv, so if the name is null then goto start again // and then in should block if(filename[0] == '\0') goto start; // Satisfy client recv send(client_socket, " ", 2, 0); // Download the file from the socket downloadFileFromSocketFd(client_socket, filename); // Log info File file; strcpy(file.filename, filename); for(int i = 0; i < numUsers; i++) { if(users[i].fd == client_socket) { strcpy(file.owner, users[i].name); break; } } pthread_mutex_lock(&filesLock); memcpy(&files[numFiles], &file, sizeof(file)); numFiles++; pthread_mutex_unlock(&filesLock); for(int i = 0; i < numFiles; i++) { printf("\nFile: %s\nOwner: %s\n", files[i].filename, files[i].owner, files[i].shared); } send(client_socket, "Finished Uploading!\n", 20, 0); printf("------------------------\n\n"); } void downloadFile(int client_socket) { printf("-----User Downloading File-----\n"); int bs; char* user; char* avaFiles[10] = {0}; char avaString[200] = {0}; char selectedFile[30] = {0}; char confirm[17]; char perms[5]; char finish[] = "File Downloaded!\n"; int num = 0; int curFiles = 0; send(client_socket, "DOWNLOADING", 12, 0); // Get users name using client_socket for(int i = 0; i < numUsers; i++) { if(users[i].fd == client_socket) { user = users[i].name; break; } } // Get all the files that they can download for(int i = 0; i < numFiles; i++) { //Check if theyre the owner if(strcmp(files[i].owner, user) == 0) { avaFiles[curFiles] = files[i].filename; //strcpy(avaFiles[curFiles], files[i].filename); curFiles++; break; } // otherwise check if its shared with them for(int j = 0; j < sizeof(files[i].shared) / sizeof(files[i].shared[j]); j++) { if(strcmp(files[i].shared[j].name, user) == 0) { avaFiles[curFiles] = files[i].filename; curFiles++; break; } } } for(int i = 0; i < curFiles; i++) { printf("%s\n", avaFiles[i]); strcat(avaString, avaFiles[i]); } printf("AVASTRING :: %s\n", avaString); // Send the file the user is able to download bs = send(client_socket, avaString, sizeof(avaString), 0); printf("BYTES SENT: %d\n", bs); printf("BYTES SENT: %d\n", bs); // Recieve file name from user, then send the file bs = recv(client_socket, selectedFile, sizeof(selectedFile), 0); sendFileToSocketFd(client_socket, selectedFile); // Once the file has been sent, wait for confirmation bs = recv(client_socket, confirm, sizeof(confirm), 0); // Get the users permissions for(int i = 0; i < numFiles; i++) { // Get the selected file if(strcmp(files[i].filename, selectedFile) == 0) { // Loop though all the shared users for(int j = 0; i < files[i].numShared; i++) { // If the user is found if(strcmp(files[i].shared[j].name, user) == 0) { // Store their permissions strncpy(perms, files[i].shared[j].perms, sizeof(perms)); } } } } // Once confirmation is recieved, send permissions bs = send(client_socket, perms, sizeof perms, 0); // Once confirmation is recieved, we can send back and client will resume from the manu bs = send(client_socket, "Download Complete", 18, 0); } void shareFile(int client_socket) { int bs; char file[MSGSIZE]; char selUser[MSGSIZE]; char perms[5]; char* init = "SHAREFILE"; char* fileNotExist = "FILENOTEXIST"; char* notOwner ="NOTOWNER"; _Bool isOwner = 0; _Bool isFound = 0; char* username; int idx; printf("-----User Sharing File Permissions ------\n"); fflush(stdout); bs = send(client_socket, init, strlen(init), 0); start: // memset file in case of goto memset(file, 0, sizeof file); // Get the file the user wants to add or remove user permissions from bs = recv(client_socket, file, sizeof(file), 0); // If the user chose to quit if(file[0] == '0') { printf("User Canceled file share\n---------------------\n"); return; } // Get their username for(int i = 0; i < numUsers; i++) { if(users[i].fd == client_socket) { username = users[i].name; } } // Check if the file exists for(int i = 0; i < numFiles; i++) { // If it does, are they the owner if(strcmp(files[i].filename, file) == 0) { isFound = 1; idx = i; if(strcmp(files[i].owner, username) == 0) { isOwner = 1; } break; } } // If the file isnt found if(!isFound) { bs = send(client_socket, fileNotExist, strlen(fileNotExist), 0); goto start; } // Check if they are not the owner if(!isOwner) { bs = send(client_socket,notOwner, strlen(notOwner), 0); printf("isOwner: %d\n", bs); goto start; } // Satisfy Client recv, msg not important bs = send(client_socket, "FILEOK", 7, 0); // Get the username and file permissions they want to add from the user bs = recv(client_socket, selUser, sizeof selUser, 0); bs = recv(client_socket, perms, sizeof perms, 0); // Check if the username exists in the shared // TODO Check if its possible to reference struct that hasnt been created for(int i = 0; i < MAXUSERS; i++) { if(strcmp(files[idx].shared[i].name, selUser) == 0) { // User already exists in shared so update perms strcpy(files[idx].shared[i].perms, perms); printf("Updated %s permissions to \"%s\"\n----------------------------------------\n", files[idx].shared[i].perms, files[idx].shared[i].name); return; } } // If not add new permissions // Probably should clean up this mess with variables but it works... strncpy(files[idx].shared[files[idx].numShared].name, selUser, sizeof(files[idx].shared[files[idx].numShared].name)); strncpy(files[idx].shared[files[idx].numShared].perms, perms, sizeof(files[idx].shared[files[idx].numShared].perms)); printf("Added %s permissions to \"%s\"\n----------------------------------------\n", files[idx].shared[files[idx].numShared].perms, files[idx].shared[files[idx].numShared].name); files[idx].numShared++; fflush(stdout); } void displayUsers(int client_socket) { char bigmsg[MSGSIZE] = {0}; char msg[50] = {0}; for(int i = 0; i < numUsers; i++) { if(users[i].isConnected == 1) { snprintf(msg, sizeof msg, "Username: %s | FD: %d\n", users[i].name, users[i].fd); strncat(bigmsg, msg, sizeof msg); } } int bs = send(client_socket, bigmsg, sizeof bigmsg, 0); printf("BYTES SENT: %d\n", bs ); } void* io_handler() { char input[50]; scanf("%s", input); if (strcmp(input, "close") == 0) { close(server_socket); exit(EXIT_SUCCESS); } }
Mason-Edwards/C-File-Transfer
utils.h
<filename>utils.h<gh_stars>0 #pragma once #ifndef _CW2_UTILS #define _CW2_UTILS void sendFileToSocketFd(int fd, char* filename); void sendEncryFileToSocketFd(int fd, char* filename); void downloadEncryFileFromSocketFd(int fd, char* filename); void downloadFileFromSocketFd(int fd, char* filename); void setBlockingFd(_Bool toggle, int fd); void xorEnc(char* data); #endif //_CW2_UTILS
Mason-Edwards/C-File-Transfer
socketinfo.h
<filename>socketinfo.h #pragma once #define MSGSIZE 256 #define PORT 9002 #define BACKLOG 50 #define MAXUSERS 100 #define DATASIZE 1024 #define FILE_NAME_SIZE 20
Mason-Edwards/C-File-Transfer
client.c
/* Client demo */ #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/types.h> #include <netdb.h> #include <netinet/in.h> #include <string.h> #include <signal.h> #include <unistd.h> #include <sys/stat.h> #include "socketinfo.h" #include "utils.h" void uploadFile(int network_socket); void downloadFile(int network_socket); void shareFile(int network_socket); int main(){ // Handle Ctrl+c to SIG_IGN to ignore ctrl + c so it doesnt // close server too. signal(SIGINT, SIG_IGN); //create a socket int network_socket; network_socket = socket (AF_INET, SOCK_STREAM, 0); // specify an address for the socket and connect to it struct sockaddr_in server_address; server_address.sin_family = AF_INET; server_address.sin_port = htons(PORT); server_address.sin_addr.s_addr= INADDR_ANY; int connection_status = connect(network_socket, (struct sockaddr*) &server_address, sizeof(server_address)); //check for error with the connection if(connection_status < 0){ printf("There was an error while making a connection to the server\n\n"); } // Send connection established message to server send(network_socket, "successfulConnection", 21, 0); while(1) { char response[MSGSIZE] = {0}; char input[20]; // Recieve Server Response recv(network_socket, response, sizeof(response), 0); // Check if the response is "EXITING" then we can break out of the loop to // close the socket if(strcmp(response, "EXITING") == 0) break; // Check if the username is taken if(strcmp(response, "NEWUSERNAME") == 0) { printf("Username taken, please enter a new one:\n>"); goto newUsername; } //Check if the respone is "UPLOAD" if(strcmp(response, "UPLOAD") == 0) { uploadFile(network_socket); continue; } if(strcmp(response, "DOWNLOADING") == 0) { downloadFile(network_socket); continue; } if(strcmp(response, "SHAREFILE") == 0) { shareFile(network_socket); memset(response, 0, sizeof response); } // Print out the server response and create a prompt printf("%s\n> ", response); newUsername: // Take User input to select option scanf("%s", input); // Send User Input int bs = send(network_socket, input, sizeof(input), 0); //printf("loop | bytes: %d\n", bs); } close(network_socket); return 0; } void uploadFile(int network_socket) { // User enter file name and send that to server char filename[30] = {0} ; char response[MSGSIZE]; start: //Get filename, also send it to the server printf("\nPlease Enter a file to upload\n> "); scanf("%s", filename); send(network_socket, filename, sizeof filename, 0); recv(network_socket, response, sizeof response, 0); if(strcmp(response, "FILEEXISTS") == 0) { memset(filename, 0, sizeof(filename)); memset(response, 0, sizeof(response)); printf("This file already exists on the server.\nPlease change the filename and reupload.\n\n"); fflush(stdout); goto start; } sendEncryFileToSocketFd(network_socket, filename); } void downloadFile(int network_socket) { char choices[200] = {0}; char input[30] = {0}; char perms[5]; char confirm[] = "FILEDOWNLOADED"; int bs = recv(network_socket, choices, sizeof(choices), 0); printf("BYTES RECIEVED: %d\n", bs); fflush(stdout); printf("Please Select a file from the list...\n"); fflush(stdout); printf("%s\n>", choices); fflush(stdout); scanf("%s", input); // Send the file the user wants to download bs = send(network_socket, input, sizeof(input), 0); downloadEncryFileFromSocketFd(network_socket, input); // Send confimation bs = send(network_socket, "DOWNLOADCOMPLETE", 17, 0); bs = recv(network_socket, perms, sizeof perms, 0); /* Note: only need to check for read perms since they can edit the file however they like by default */ // Read Only Perms if(perms[0] == '1') { // Set file to readonly for everyone // Read permissions owner: S_IRUSR // Read permissions group: S_IRGRP // Read permissions others: S_IROTH chmod(input, S_IRUSR | S_IRGRP | S_IROTH); } bs = send(network_socket, "FINALLYDONE", 12, 0); } void shareFile(int network_socket) { int bs; char response[MSGSIZE] = {0}; char choice[MSGSIZE]; start: memset(choice, 0, sizeof choice); // print menu msg printf("What file do you want to share permissions with other users? (Enter 0 to exit)\n"); fflush(stdout); scanf("%s>", choice); bs = send(network_socket, choice, sizeof(choice), 0); if(choice[0] == '0') return; bs = recv(network_socket, response, sizeof(response), 0); if(strcmp(response, "FILENOTEXIST") == 0) { printf("File does not exist on the server.\n\n"); goto start; } if(strcmp(response, "NOTOWNER") == 0) { printf("You are not the owner of this file, please select one you are an owner of.\n\n"); goto start; } printf("What is the user you want to share the file with?\n"); fflush(stdout); scanf("%s>", choice); // If stuff starts going weird then memset choice send(network_socket, choice, sizeof choice, 0); printf("\nWhat is the permissions you want the user to have?\n1. Read\n2. Read and Write\n\n>"); fflush(stdout); scanf("%s>", choice); send(network_socket, choice, sizeof choice, 0); }
Mason-Edwards/C-File-Transfer
utils.c
<filename>utils.c<gh_stars>0 #include <stdio.h> #include <sys/socket.h> #include <errno.h> #include <fcntl.h> #include <string.h> #include <unistd.h> #include "utils.h" #include "socketinfo.h" void sendFileToSocketFd(int fd, char* filename) { FILE* fp = fopen(filename, "r"); printf("-----Uploading-----\n"); char data[DATASIZE] = {0}; // If file opens correctly if(fp != NULL) { // While there is data in the file, Read 1mb of data into "data" and send it while(fgets(data, sizeof data, fp) != NULL) { printf("Sending %s\n\n\n", data); if(send(fd, data, sizeof data, 0) == -1) { printf("ERROR SENDING FILE\n"); } // Clear data for next iteration, otherwise garbage is left for(int i = 0; i < DATASIZE; i++) { data[i] = 0; } } } else if (fp == NULL) printf("ERROR READING FILE\n"); printf("------------------\n\n"); fclose(fp); } void downloadEncryFileFromSocketFd(int fd, char* filename) { printf("Filename: %s\n", filename); FILE* fp = fopen(filename, "w"); if(fp == NULL) printf("ERROR OPENING FILE\n"); // Set file descriptor to non blocking setBlockingFd(0, fd); // Sleep for 200ms to make sure file is being sent usleep(200*1000); while(1) { char data[DATASIZE] = {0}; char cleanedData[DATASIZE] = {0}; int cdSize = 0; int response = recv(fd, data, sizeof(data), 0); // If no msgs are avaliable or there is an error then break if(response <= 0) { printf("End of Stream\n"); break; } // Clean up stream // Client sends bunch of nulls, so only write chars that arent null // to cleanedData, then write that to the file for(int i = 0; i < sizeof(data)/sizeof(char); i++) { // If the char is not null, add it to the array if(data[i] != '\0') { cleanedData[cdSize] = data[i]; cdSize++; } } // Add null termiator to end of string cleanedData[cdSize] = '\0'; // Xor data download xorEnc(cleanedData); // Print Bytes Recieved and the cleaned data printf("Bytes Recieved: %d\n", response); printf("DATA: %s\n\n\n", cleanedData); fflush(stdout); //Write data into file fprintf(fp, "%s", cleanedData); fflush(fp); } // Set fd back to blocking setBlockingFd(1, fd); fflush(fp); fclose(fp); } void setBlockingFd(_Bool toggle, int fd) { static _Bool cur = 1; if(toggle == cur) return; if(toggle == 0) { cur = 0; // Set the socket to non blocking int flags = fcntl(fd, F_GETFL, 0); if (flags == -1) printf("ERROR GETTING SOCKET FLAGS\n"); flags |= O_NONBLOCK; int status = fcntl(fd, F_SETFL, flags); if(status == -1) printf("ERROR SETTING SOCKET TO NON BLOCKING 2\n"); printf("SOCKET NON BLOCK\n"); } else { cur = 1; int flags = fcntl(fd, F_GETFL, 0); if (flags == -1) printf("ERROR GETTING SOCKET FLAGS\n"); flags &= ~O_NONBLOCK; int status = fcntl(fd, F_SETFL, flags); if(status == -1) printf("ERROR SETTING SOCKET TO BLOCKING \n"); printf("SOCKET BLOCK\n"); } } void xorEnc(char *data) { // Cant xor by too much otherwise characters xor // to null. Cannot clean nulls since they xor // back into characters char totallySecretKey = 4; for(int i = 0; i < strlen(data); i++) { *(data+i) ^= totallySecretKey; } data[strlen(data)] = '\0'; } void downloadFileFromSocketFd(int fd, char* filename) { printf("Filename: %s\n", filename); FILE* fp = fopen(filename, "w"); if(fp == NULL) printf("ERROR OPENING FILE\n"); // Set file descriptor to non blocking setBlockingFd(0, fd); // Sleep for 200ms to make sure file is being sent usleep(200*1000); while(1) { char data[DATASIZE] = {0}; char cleanedData[DATASIZE] = {0}; int cdSize = 0; int response = recv(fd, data, sizeof(data), 0); // If no msgs are avaliable or there is an error then break if(response <= 0) { printf("End of Stream\n"); break; } // Clean up stream // Client sends bunch of nulls, so only write chars that arent null // to cleanedData, then write that to the file for(int i = 0; i < sizeof(data)/sizeof(char); i++) { // If the char is not null, add it to the array if(data[i] != '\0') { cleanedData[cdSize] = data[i]; cdSize++; } } // Add null termiator to end of string cleanedData[cdSize] = '\0'; // Xor data download // xorEnc(cleanedData); // Print Bytes Recieved and the cleaned data printf("Bytes Recieved: %d\n", response); printf("DATA: %s\n\n\n", cleanedData); fflush(stdout); //Write data into file fprintf(fp, "%s", cleanedData); fflush(fp); } // Set fd back to blocking setBlockingFd(1, fd); fflush(fp); fclose(fp); } void sendEncryFileToSocketFd(int fd, char* filename) { FILE* fp = fopen(filename, "r"); printf("-----Uploading-----\n"); char data[DATASIZE] = {0}; // If file opens correctly if(fp != NULL) { // While there is data in the file, Read 1mb of data into "data" and send it while(fgets(data, sizeof data, fp) != NULL) { xorEnc(data); printf("Sending %s\n\n\n", data); if(send(fd, data, sizeof data, 0) == -1) { printf("ERROR SENDING FILE\n"); } // Clear data for next iteration, otherwise garbage is left for(int i = 0; i < DATASIZE; i++) { data[i] = 0; } } } else if (fp == NULL) printf("ERROR READING FILE\n"); printf("------------------\n\n"); fclose(fp); }
edisonslightbulbs/yolo-cpp
include/utility.h
#ifndef UTILITY_H #define UTILITY_H #include <unistd.h> #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-result" std::string pwd() { char buff[FILENAME_MAX]; getcwd(buff, FILENAME_MAX); std::string workingDir(buff); return workingDir; } #pragma GCC diagnostic pop #endif /* UTILITY_H */
craflin/invtun
Src/Server/UplinkHandler.h
#pragma once #include <nstd/Socket/Server.h> #include <nstd/Buffer.h> #include "Protocol.h" #include "Callback.h" class ServerHandler; class UplinkHandler : public Callback { public: UplinkHandler(ServerHandler& serverHandler, Server& server); ~UplinkHandler(); bool accept(Server::Handle& listenerHandle); bool sendConnect(uint32 connectionId, uint16 port); bool sendDisconnect(uint32 connectionId); bool sendData(uint32 connectionId, const byte* data, size_t size); bool sendSuspend(uint32 connectionId); bool sendResume(uint32 connectionId); private: ServerHandler& serverHandler; Server& server; Server::Handle* handle; uint32 addr; uint16 port; bool authed; Buffer lz4Buffer; Buffer readBuffer; private: void handleMessage(Protocol::MessageType messageType, byte* data, size_t size); void handleAuthMessage(Protocol::AuthMessage& authMessage); void handleDisconnectMessage(const Protocol::DisconnectMessage& disconnectMessage); void handleDataMessage(const Protocol::DataMessage& dataMessage, byte* data, size_t size); void handleSuspendMessage(const Protocol::SuspendMessage& suspendMessage); void handleResumeMessage(const Protocol::ResumeMessage& resumeMessage); private: // Callback virtual void readClient(); virtual void writeClient(); virtual void closedClient(); };
craflin/invtun
Src/Client/DownlinkHandler.h
#pragma once #include <nstd/Socket/Server.h> #include <nstd/Buffer.h> #include "Protocol.h" #include "Callback.h" class ClientHandler; class DownlinkHandler : public Callback { public: DownlinkHandler(ClientHandler& clientHandler, Server& server); ~DownlinkHandler(); bool connect(uint32 addr, uint16 port); bool sendDisconnect(uint32 connectionId); bool sendData(uint32 connectionId, byte* data, size_t size); bool sendSuspend(uint32 connectionId); bool sendResume(uint32 connectionId); private: ClientHandler& clientHandler; Server& server; Server::Handle* handle; uint32 addr; uint16 port; bool connected; bool authed; Buffer lz4Buffer; Buffer readBuffer; private: void handleMessage(Protocol::MessageType messageType, byte* data, size_t size); void handleConnectMessage(const Protocol::ConnectMessage& connect); void handleDisconnectMessage(const Protocol::DisconnectMessage& disconnect); void handleDataMessage(const Protocol::DataMessage& message, byte* data, size_t size); void handleSuspendMessage(const Protocol::SuspendMessage& suspendMessage); void handleResumeMessage(const Protocol::ResumeMessage& resumeMessage); private: // Callback virtual void openedClient(); virtual void abolishedClient(); virtual void readClient(); virtual void writeClient(); virtual void closedClient(); };
craflin/invtun
Src/Server/EntryHandler.h
<reponame>craflin/invtun #pragma once #include <nstd/Socket/Server.h> #include "Callback.h" class ServerHandler; class EntryHandler : public Callback { public: EntryHandler(ServerHandler& serverHandler, Server& server, uint32 connectionId); ~EntryHandler(); uint32 getConnectionId() const {return connectionId;} bool accept(Server::Handle& listenerHandle); void sendData(const byte* data, size_t size); void suspend(); void resume(); void suspendByUplink(); void resumeByUplink(); private: ServerHandler& serverHandler; Server& server; Server::Handle* handle; uint32 connectionId; uint32 addr; uint16 port; bool suspended; bool suspendedByUplink; private: // Server::Client::Listener virtual void readClient(); virtual void writeClient(); virtual void closedClient(); };
craflin/invtun
Src/Client/EndpointHandler.h
<filename>Src/Client/EndpointHandler.h #pragma once #include <nstd/Buffer.h> #include <nstd/Socket/Server.h> #include "Callback.h" class ClientHandler; class EndpointHandler : public Callback { public: EndpointHandler(ClientHandler& clientHandler, Server& server, uint32 connectionId); ~EndpointHandler(); uint32 getConnectionId() const {return connectionId;} bool connect(uint16 port); void sendData(byte* data, size_t size); void suspend(); void resume(); void suspendByDownlink(); void resumeByDownlink(); private: ClientHandler& clientHandler; Server& server; Server::Handle* handle; uint32 connectionId; uint16 port; bool connected; Buffer sendBuffer; bool suspended; bool suspendedByDownlink; private: // Callback virtual void openedClient(); virtual void abolishedClient(); virtual void closedClient(); virtual void readClient(); virtual void writeClient(); };
craflin/invtun
Src/Protocol.h
#pragma once #include <nstd/String.h> class Protocol { public: enum MessageType { error, auth, authResponse, connect, disconnect, data, suspend, resume, }; #pragma pack(push, 1) struct Header { uint32 size:24; uint8 messageType; // MessageType }; struct AuthMessage : public Header { char secret[33]; }; struct ConnectMessage : public Header { uint32 connectionId; uint16 port; }; struct DisconnectMessage : public Header { uint32 connectionId; }; struct DataMessage : public Header { uint32 connectionId; uint32 originalSize:24; }; struct SuspendMessage : public Header { uint32 connectionId; }; struct ResumeMessage : public Header { uint32 connectionId; }; #pragma pack(pop) template<size_t N> static void setString(char(&str)[N], const String& value) { size_t size = value.length() + 1; if(size > N - 1) size = N - 1; Memory::copy(str, (const char*)value, size); str[N - 1] = '\0'; } template<size_t N> static String getString(char(&str)[N]) { str[N - 1] = '\0'; String result; result.attach(str, String::length(str)); return result; } };
craflin/invtun
Src/Client/ClientHandler.h
#pragma once #include <nstd/Socket/Server.h> #include <nstd/HashMap.h> #include <nstd/String.h> #include "Callback.h" #define SEND_BUFFER_SIZE (256 * 1024) #define RECV_BUFFER_SIZE (256 * 1024) class DownlinkHandler; class EndpointHandler; class ClientHandler : public Callback { public: ClientHandler(Server& server); ~ClientHandler(); const String& getSecret() const {return secret;} bool connect(uint32 addr, uint16 port, const String& secret); bool removeDownlink(); bool createEndpoint(uint32 connectionId, uint16 port); bool removeEndpoint(uint32 connectionId); bool sendDataToDownlink(uint32 connectionId, byte* data, size_t size); bool sendDataToEndpoint(uint32 connectionId, byte* data, size_t size); void sendSuspendEntry(uint32 connectionId); void sendResumeEntry(uint32 connectionId); void suspendEndpoint(uint32 connectionId); void resumeEndpoint(uint32 connectionId); void suspendAllEndpoints(); void resumeAllEndpoints(); private: Server& server; uint32 addr; uint16 port; String secret; DownlinkHandler* downlink; HashMap<uint32, EndpointHandler*> endpoints; bool suspendedAlldEnpoints; Server::Handle* reconnectTimer; private: // Callback virtual void executeTimer(); };
craflin/invtun
Src/Server/ServerHandler.h
<reponame>craflin/invtun #pragma once #include <nstd/HashMap.h> #include <nstd/String.h> #include <nstd/Socket/Server.h> #include "Callback.h" #define SEND_BUFFER_SIZE (256 * 1024) #define RECV_BUFFER_SIZE (256 * 1024) class EntryHandler; class UplinkHandler; class ServerHandler : public Callback { public: ServerHandler(Server& server); ~ServerHandler(); const String& getSecret() const {return secret;} bool listen(uint32 addr, uint16 port, const String& secret); bool listen(uint32 addr, uint16 port, uint16 mappedPort); bool removeUplink(); bool removeEntry(uint32 connectionId); bool sendDataToEntry(uint32 connectionId, byte* data, size_t size); bool sendDataToUplink(uint32 connectionId, byte* data, size_t size); void sendSuspendEndpoint(uint32 connectionId); void sendResumeEndpoint(uint32 connectionId); void suspendEntry(uint32 connectionId); void resumeEntry(uint32 connectionId); void suspendAllEntries(); void resumeAllEntries(); private: Server& server; Server::Handle* tunnelListener; HashMap<Server::Handle*, uint16> inboundListeners; String secret; UplinkHandler* uplink; HashMap<uint32, EntryHandler*> entries; uint32 nextConnectionId; bool suspendedAllEntries; private: uint16 mapPort(Server::Handle& handle) {return *inboundListeners.find(&handle);} private: // Callback virtual void acceptClient(Server::Handle& handle); };
craflin/invtun
Src/Callback.h
<filename>Src/Callback.h #pragma once #include <nstd/Socket/Server.h> class Callback { public: virtual void openedClient() {} virtual void readClient() {} virtual void writeClient() {} virtual void closedClient() {} virtual void abolishedClient() {} virtual void acceptClient(Server::Handle& handle) {} virtual void executeTimer() {} };
uxyheaven/XYQuick
Example/XYQuick/Model/Test2Model.h
<reponame>uxyheaven/XYQuick // // Test2Model.h // JoinShow // // Created by Heaven on 13-12-12. // Copyright (c) 2013年 Heaven. All rights reserved. // #import "EntityBaseModel.h" @interface Test2Model : EntityBaseModel @end
uxyheaven/XYQuick
Example/XYQuick/Controller/UISignalVC.h
// // UISignalVC.h // JoinShow // // Created by Heaven on 14-5-20. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> #import "ViewControllerDemo.h" #import "XYUISignal.h" @interface UISignal1 : UIView AS_SIGNAL( click1 ) @end @interface UISignal2 : UIView AS_SIGNAL( click2 ) @property (nonatomic, strong) UIButton *btn; @end @interface UISignal2_child : UISignal2 @end @interface UISignalVC : UIViewController<ViewControllerDemo> AS_SIGNAL( click3 ) @end
uxyheaven/XYQuick
Pod/Classes/ui/extension/UIViewController+XY.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <UIKit/UIKit.h> #pragma mark - typedef void(^UIViewController_block_void) (void); typedef void(^UIViewController_block_view) (UIView *view); @interface UIViewController (XYExtension) @property (nonatomic, strong) id uxy_parameters; // 参数 // 导航 - (void)uxy_pushVC:(NSString *)vcName; - (void)uxy_pushVC:(NSString *)vcName object:(id)object; - (void)uxy_popVC; // 模态 带导航控制器 - (void)uxy_modalVC:(NSString *)vcName withNavigationVC:(NSString *)navName; - (void)uxy_modalVC:(NSString *)vcName withNavigationVC:(NSString *)navName object:(id)object succeed:(UIViewController_block_void)block; - (void)uxy_dismissModalVC; - (void)uxy_dismissModalVCWithSucceed:(UIViewController_block_void)block; #define UserGuide_tag 30912 /** * @brief 显示用户引导图 * @param imgName 图片名称,默认用无图片缓存方式加载, UIImageView tag == UserGuide_tag * @param key 引导图的key,默认每个key只显示一次 * @param frameString 引导图的位置, full 全屏, center 居中, frame : @"{{0,0},{100,100}}", center : @"{{100,100}}" * @param block 点击背景执行的方法, 默认是淡出 * @return 返回底层的蒙板view */ - (id)uxy_showUserGuideViewWithImage:(NSString *)imgName key:(NSString *)key alwaysShow:(BOOL)isAlwaysShow frame:(NSString *)frameString tapExecute:(UIViewController_block_view)block; @end @protocol XYSwitchControllerProtocol <NSObject> - (id)initWithObject:(id)object; @end
uxyheaven/XYQuick
Example/XYQuick/XYViewController.h
// // XYViewController.h // XYQuick // // Created by xingyao095 on 04/22/2016. // Copyright (c) 2016 xingyao095. All rights reserved. // @import UIKit; @interface XYViewController : UIViewController @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/module/XYModuleLifecycle.h
// // XYModuleLifecycle.h // XYQuick // // Created by heaven on 2016/12/20. // Copyright © 2016年 xingyao095. All rights reserved. // #import <UIKit/UIKit.h> @interface XYModuleLifecycle : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
uxyheaven/XYQuick
Pod/Classes/ui/modules/XYKeyboardHelper.h
<reponame>uxyheaven/XYQuick<gh_stars>100-1000 // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // This file Copy from Justin IQKeyboardHelper. #import "XYQuick_Predefine.h" #import <UIKit/UIKit.h> #pragma mark - #define XYKeyboardHelper_DefaultDistance 10.0 @interface XYKeyboardHelper : NSObject + (instancetype)sharedInstance; + (void)purgeSharedInstance; @property(nonatomic, assign) CGFloat keyboardDistanceFromTextField; // can't be less than zero. Default is 10.0 @property(nonatomic, assign) BOOL isEnabled; //Enable keyboard Helper. - (void)enableKeyboardHelper; /*default enabled*/ //Desable keyboard Helper. - (void)disableKeyboardHelper; @end /*****************UITextField***********************/ @interface UITextField (ToolbarOnKeyboard) //Helper functions to add Done button on keyboard. - (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action; //Helper function to add SegmentedNextPrevious and Done button on keyboard. - (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction; //Helper methods to enable and desable previous next buttons. - (void)setEnablePrevious:(BOOL)isPreviousEnabled next:(BOOL)isNextEnabled; @end /*****************UITextView***********************/ @interface UITextView (ToolbarOnKeyboard) //Helper functions to add Done button on keyboard. - (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action; //Helper function to add SegmentedNextPrevious and Done button on keyboard. - (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction; //Helper methods to enable and desable previous next buttons. - (void)setEnablePrevious:(BOOL)isPreviousEnabled next:(BOOL)isNextEnabled; @end /*****************XYSegmentedNextPrevious***********************/ @interface XYSegmentedNextPrevious : UISegmentedControl { __weak id buttonTarget; SEL previousSelector; SEL nextSelector; } - (id)initWithTarget:(id)target previousSelector:(SEL)pSelector nextSelector:(SEL)nSelector; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/DemoTableViewController.h
<filename>Example/XYQuick/Controller/DemoTableViewController.h // // DomeTableViewController.h // JoinShow // // Created by Heaven on 13-8-23. // Copyright (c) 2013年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> @interface DemoTableViewController : UITableViewController @property (nonatomic, strong) NSArray *list; @end
uxyheaven/XYQuick
Pod/Classes/core/modules/XYSystemInfo.h
<gh_stars>100-1000 // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // This file Copy from Samurai. #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #import <CoreGraphics/CoreGraphics.h> #pragma mark - #define XY_SCREEN_WIDTH UIScreen.mainScreen.bounds.size.width #define XY_SCREEN_HEIGHT UIScreen.mainScreen.bounds.size.height #pragma mark - #define XY_IOS10_OR_LATER [[XYSystemInfo sharedInstance] isOsVersionOrLater:@"10.0"] #define XY_IOS9_OR_LATER [[XYSystemInfo sharedInstance] isOsVersionOrLater:@"9.0"] #define XY_IOS8_OR_LATER [[XYSystemInfo sharedInstance] isOsVersionOrLater:@"8.0"] #define XY_IOS7_OR_LATER [[XYSystemInfo sharedInstance] isOsVersionOrLater:@"7.0"] #define XY_IOS6_OR_LATER [[XYSystemInfo sharedInstance] isOsVersionOrLater:@"6.0"] #define XY_IOS5_OR_LATER [[XYSystemInfo sharedInstance] isOsVersionOrLater:@"5.0"] #define XY_IOS4_OR_LATER [[XYSystemInfo sharedInstance] isOsVersionOrLater:@"4.0"] #define XY_IOS10_OR_EARLIER [[XYSystemInfo sharedInstance] isOsVersionOrEarlier:@"10.0"] #define XY_IOS9_OR_EARLIER [[XYSystemInfo sharedInstance] isOsVersionOrEarlier:@"9.0"] #define XY_IOS8_OR_EARLIER [[XYSystemInfo sharedInstance] isOsVersionOrEarlier:@"8.0"] #define XY_IOS7_OR_EARLIER [[XYSystemInfo sharedInstance] isOsVersionOrEarlier:@"7.0"] #define XY_IOS6_OR_EARLIER [[XYSystemInfo sharedInstance] isOsVersionOrEarlier:@"6.0"] #define XY_IOS5_OR_EARLIER [[XYSystemInfo sharedInstance] isOsVersionOrEarlier:@"5.0"] #define XY_IOS4_OR_EARLIER [[XYSystemInfo sharedInstance] isOsVersionOrEarlier:@"4.0"] @interface XYSystemInfo : NSObject + (instancetype)sharedInstance; + (void)purgeSharedInstance; #pragma mark- app,设备相关 - (NSString *)osVersion; - (NSString *)bundleVersion; - (NSString *)bundleShortVersion; - (NSString *)bundleIdentifier; - (NSString *)urlSchema; - (NSString *)urlSchemaWithName:(NSString *)name; - (NSString *)deviceModel; - (NSString *)deviceUUID; /// 返回设备IP - (NSString *)deviceIPAdress; /// 获取当前网络状态, @"无网络", @"2G", @"3G", @"4G", @"WIFI", @"error" - (NSString *)netWorkState; /// 是否越狱 - (BOOL)isJailBroken NS_AVAILABLE_IOS(4_0); /// 在iPhone设备上运行 - (BOOL)runningOnPhone; // 在iPad设备上运行 - (BOOL)runningOnPad; - (BOOL)requiresPhoneOS; #pragma mark- 屏幕相关 - (CGSize)screenSize; - (BOOL)isScreenPhone; - (BOOL)isScreen320x480; // 这个是历史了 - (BOOL)isScreen640x960; // ip4s - (BOOL)isScreen640x1136; // ip5 ip5s ip6放大模式 - (BOOL)isScreen750x1334; // ip6 - (BOOL)isScreen1242x2208; // ip6p - (BOOL)isScreen1125x2001; // ip6p放大模式 - (BOOL)isScreenPad; - (BOOL)isScreen768x1024; - (BOOL)isScreen1536x2048; // 是否retina屏 - (BOOL)isRetina; - (BOOL)isScreenSizeSmallerThan:(CGSize)size; - (BOOL)isScreenSizeBiggerThan:(CGSize)size; - (BOOL)isScreenSizeEqualTo:(CGSize)size; #pragma mark- 版本判断相关 - (BOOL)isOsVersionOrEarlier:(NSString *)ver; - (BOOL)isOsVersionOrLater:(NSString *)ver; - (BOOL)isOsVersionEqualTo:(NSString *)ver; #pragma mark- 第一次启动相关 - (BOOL)isFirstRunWithUser:(NSString *)user event:(NSString *)event; - (BOOL)isFirstRunAtCurrentVersionWithUser:(NSString *)user event:(NSString *)event; - (void)setFirstRun:(BOOL)isFirst user:(NSString *)user event:(NSString *)event; @end
uxyheaven/XYQuick
Pod/Classes/event/modules/XYNotification.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #pragma mark - #pragma mark - #define // 声明一个notification name #define uxy_def_notification_name( __name ) uxy_staticConstString( __name ) // 响应一个 notification #define uxy_handleNotification( __name, __notification ) \ - (void)__uxy_handleNotification_##__name:(NSNotification *)__notification typedef void(^XYNotification_block)(NSNotification *notification); #pragma mark - XYNotification @interface XYNotification : NSObject @end #pragma mark - NSObject (XYNotification) // 注意这里 self 自己可能是被观察者; 也可能 self 持有了观察者, 在self 销毁的时候, 取消所有的观察 @interface NSObject (XYNotification) @property (nonatomic, readonly, strong) NSMutableDictionary *uxy_notifications; - (void)uxy_registerNotification:(const char *)name; - (void)uxy_registerNotification:(const char *)name block:(XYNotification_block)block; - (void)uxy_unregisterNotification:(const char *)name; - (void)uxy_unregisterAllNotification; - (void)uxy_postNotification:(const char *)name userInfo:(id)userInfo; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/BlackMagicVC.h
// // BlackMagicVC.h // JoinShow // // Created by Heaven on 14/11/14. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> #import "ViewControllerDemo.h" @interface BlackMagicVC : UITableViewController<ViewControllerDemo> @property (nonatomic, strong) NSArray *items; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/DatabaseVC.h
// // DatabaseVC.h // JoinShow // // Created by Heaven on 13-9-16. // Copyright (c) 2013年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> #import "ViewControllerDemo.h" @interface DatabaseVC : UIViewController<ViewControllerDemo> @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYMaterial.h
// // XYMaterial.h // JoinShow // // Created by Heaven on 14-1-17. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> @interface XYMaterial : NSObject @end
uxyheaven/XYQuick
Pod/Classes/ui/modules/XYBaseViewController.h
<filename>Pod/Classes/ui/modules/XYBaseViewController.h // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <UIKit/UIKit.h> #pragma mark - #pragma mark - 生命周期 /** 生命周期 loadView 1. uxy_createFields 2. uxy_createViews 3. uxy_createEvents viewDidLoad 1. uxy_loadData dealloc 1. uxy_destroyEvents 2. uxy_destroyViews 3. uxy_destroyFields didReceiveMemoryWarning 1. uxy_cleanData 规则 1. 在uxy_createFields方法中接收从上一个页面传递过来的参数 2. 在uxy_createFields方法中初始化变量 3. 将要操作的控件, 都在ViewController中作为类级别的变量来声明 3. 在uxy_createViews方法中, 加载xib文件,并通过Tag给控件一次性赋值 4. 在uxy_createEvent方法中, 为控件挂上事件方法, 比如按钮的点击 5. 如果有Notification, 统一在uxy_createEvent方法中addObserver, 在uxy_destroyEvent方法中removeObserver 6. 在uxy_destroyFields方法中, 释放/销毁所有引用型变量。 7. 在uxy_destroyViews方法中, 释放/销毁所有控件。 8) 在uxy_cleanData方法中释放一些可以释放的数据 */ #pragma mark - @protocol XYViewController <NSObject> @optional // 创建/销毁页面级变量, model的地方 - (void)uxy_createFields; - (void)uxy_destroyFields; // 创建/销毁页面内控件的地方。 - (void)uxy_createViews; - (void)uxy_destroyViews; // 创建/销毁页面内控件事件的地方 - (void)uxy_createEvents; - (void)uxy_destroyEvents; // 如果页面加载过程需要读取数据, 则写在这个地方。 - (void)uxy_loadData; // 进入后台时 - (void)uxy_enterBackground; // 进入前台时 - (void)uxy_enterForeground; // 已经加载, 不在window上的vc, 收到内存警告 - (void)uxy_cleanData; @end typedef UIViewController XYBaseViewController; @interface UIViewController (XYBase) #pragma mark- as #pragma mark- model #pragma mark- view #pragma mark- api @end
uxyheaven/XYQuick
Pod/Classes/core/extension/NSString+XY.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #pragma mark - @interface NSString (XYExtension) @property (nonatomic, readonly, strong) NSData *uxy_MD5Data; @property (nonatomic, readonly, copy) NSString *uxy_MD5String; @property (nonatomic, readonly, strong) NSData *uxy_SHA1Data; @property (nonatomic, readonly, copy) NSString *uxy_SHA1String; /// base64解码 @property (nonatomic, readonly, copy) NSString *uxy_BASE64Decrypted; // URL相关 - (NSArray *)uxy_allURLs; - (NSString *)uxy_URLByAppendingDict:(NSDictionary *)params; - (NSString *)uxy_URLByAppendingDict:(NSDictionary *)params encoding:(BOOL)encoding; - (NSString *)uxy_URLByAppendingArray:(NSArray *)params; - (NSString *)uxy_URLByAppendingArray:(NSArray *)params encoding:(BOOL)encoding; - (NSString *)uxy_URLByAppendingKeyValues:(id)first, ...; + (NSString *)uxy_queryStringFromDictionary:(NSDictionary *)dict; + (NSString *)uxy_queryStringFromDictionary:(NSDictionary *)dict encoding:(BOOL)encoding;; + (NSString *)uxy_queryStringFromArray:(NSArray *)array; + (NSString *)uxy_queryStringFromArray:(NSArray *)array encoding:(BOOL)encoding;; + (NSString *)uxy_queryStringFromKeyValues:(id)first, ...; /// URL编码 - (NSString *)uxy_URLEncoding; /// URL解码 - (NSString *)uxy_URLDecoding; /// 从URL的query里返回字典, like "a=a&b=b". - (NSMutableDictionary *)uxy_dictionaryFromQueryComponents; /// 去掉首尾的空格和换行 - (NSString *)uxy_trim; /// 去掉首尾的引号 " ' - (NSString *)uxy_unwrap; /// 拼接重复的self - (NSString *)uxy_repeat:(NSUInteger)count; - (NSString *)uxy_normalize; - (BOOL)uxy_match:(NSString *)expression; - (BOOL)uxy_matchAnyOf:(NSArray *)array; - (BOOL)uxy_empty; - (BOOL)uxy_notEmpty; - (BOOL)uxy_eq:(NSString *)other; - (BOOL)uxy_equal:(NSString *)other; - (BOOL)uxy_is:(NSString *)other; - (BOOL)uxy_isNot:(NSString *)other; // 是否在array里, caseInsens 区分大小写 - (BOOL)uxy_isValueOf:(NSArray *)array; - (BOOL)uxy_isValueOf:(NSArray *)array caseInsens:(BOOL)caseInsens; #pragma mark - bee里的检测 - (BOOL)uxy_isNormal; - (BOOL)uxy_isTelephone; // 新号段不支持了, 这方法需要时不时更新, 建议自己实现 - (BOOL)uxy_isUserName; - (BOOL)uxy_isChineseUserName; - (BOOL)uxy_isPassword; - (BOOL)uxy_isEmail; - (BOOL)uxy_isURL; - (BOOL)uxy_isIPAddress; #pragma mark - 额外的检测 // 包含一个字符和数字 - (BOOL)uxy_isHasCharacterAndNumber; // 昵称 - (BOOL)uxy_isNickname; - (BOOL)uxy_isTelephone2; - (NSString *)uxy_substringFromIndex:(NSUInteger)from untilCharset:(NSCharacterSet *)charset; - (NSString *)uxy_substringFromIndex:(NSUInteger)from untilCharset:(NSCharacterSet *)charset endOffset:(NSUInteger *)endOffset; + (NSString *)uxy_fromResource:(NSString *)resName; // 中英文混排,获取字符串长度 - (NSInteger)uxy_getLength; - (NSInteger)uxy_getLength2; // Unicode格式的字符串编码转成中文的方法(如\u7E8C)转换成中文,unicode编码以\u开头 - (NSString *)uxy_replaceUnicode; /** * 擦除保存的值, 建议敏感信息在不用的是调用此方法擦除. * 如果是这样 _text = @"information"的 被分配到data区的无法擦除 */ - (void)uxy_erasure; /// 返回单词缩写 (International Business Machines 变成 IBM) - (NSString*)uxy_stringByInitials; /// 返回显示字串所需要的尺寸 - (CGSize)uxy_calculateSize:(CGSize)size font:(UIFont *)font; /// 返回阅读字串需要的时间 (length * 0.1 + 2, 2) - (NSTimeInterval)uxy_displayTime; @end #pragma mark -
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYEvent.h
// // XYEvent.h // JoinShow // // Created by XingYao on 15/7/1. // Copyright (c) 2015年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> @interface XYEventCenter : NSObject + (instancetype)defaultCenter; - (void)addTarget:(id)target action:(SEL)action forEvent:(NSString *)event; - (void)removeTarget:(id)target action:(SEL)action forEvent:(NSString *)event; - (void)removeAllEventsAtTarget:(id)target; - (void)sendAction:(SEL)action to:(id)target forEvent:(NSString *)event; - (void)sendActionsForEvent:(NSString *)event; @end /* @protocol XYEvent <NSObject> @property (nonatomic, weak) id uxy_nextTarget; @property (nonatomic, weak, readonly) id uxy_defaultNextTarget; @end */
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYUISignal.h
// // XYUISignal.h // JoinShow // // Created by Heaven on 14-5-19. // Copyright (c) 2014年 Heaven. All rights reserved. // Copy from bee Framework #import "XYQuick_Predefine.h" #define __XY_UISIGNAL_CALLPATH__ 1 // 职责链模式(chain of responsibility) #pragma mark - #define #undef AS_SIGNAL #define AS_SIGNAL( __name ) \ - (NSString *)__name; \ + (NSString *)__name; #undef DEF_SIGNAL #define DEF_SIGNAL( __name ) \ - (NSString *)__name \ { \ return (NSString *)[[self class] __name]; \ } \ + (NSString *)__name \ { \ static NSString * __local = nil; \ if ( nil == __local ) \ { \ __local = [NSString stringWithFormat:@"%@.%@.%s", @"signal", [self description], #__name]; \ } \ return UXY_RETAIN(__local); \ } #undef ON_SIGNAL #define ON_SIGNAL( __signal ) \ - (void)handleUISignal:(XYUISignal *)__signal #undef ON_SIGNAL2 #define ON_SIGNAL2( __filter, __signal ) \ - (void)handleUISignal_##__filter:(XYUISignal *)__signal #undef ON_SIGNAL3 #define ON_SIGNAL3( __class, __name, __signal ) \ - (void)handleUISignal_##__class##_##__name:(XYUISignal *)__signal #pragma mark - XYUISignal : NSObject @interface XYUISignal : NSObject @property (nonatomic, assign) BOOL isDead; // 杀死SIGNAL @property (nonatomic, assign) BOOL isReach; // 是否触达顶级ViewController @property (nonatomic, assign) NSUInteger jump; // 转发次数 @property (nonatomic, assign) id source; // 发送来源 @property (nonatomic, assign) id target; // 转发目标 @property (nonatomic, copy ) NSString *name; // Signal名字 @property (nonatomic, copy ) NSString *namePrefix; // Signal前辍 @property (nonatomic, strong) NSObject *object; // 附带参数 @property (nonatomic, strong) NSObject *returnValue; // 返回值,默认为空 @property (nonatomic, copy ) NSString *preSelector; // 返回值,默认为空 @property (nonatomic, copy ) NSMutableString *callPath; // 调用路径 - (BOOL)is:(NSString *)name; - (BOOL)isKindOf:(NSString *)prefix; - (BOOL)isSentFrom:(id)source; // 发送 - (BOOL)send; // 转发 - (BOOL)forward; - (BOOL)forward:(id)target; - (BOOL)boolValue; - (void)returnYES; - (void)returnNO; @end #pragma mark - NSObject(XYUISignalResponder) @interface NSObject(XYUISignalResponder) // 是否响应Signal //- (BOOL)isUISignalResponder; @end #pragma mark - UIView(XYUISignal) @interface UIView(XYUISignal) @property (nonatomic, copy) NSString *nameSpace; + (NSString *)SIGNAL; + (NSString *)SIGNAL_TYPE; //- (void)handleUISignal:(XYUISignal *)signal; - (XYUISignal *)sendUISignal:(NSString *)name; - (XYUISignal *)sendUISignal:(NSString *)name withObject:(NSObject *)object; - (XYUISignal *)sendUISignal:(NSString *)name withObject:(NSObject *)object from:(id)source; - (XYUISignal *)sendUISignal:(NSString *)name withObject:(NSObject *)object from:(id)source to:(id)target; @end #pragma mark - UIViewController(XYUISignal) @interface UIViewController(XYUISignal) @property (nonatomic, copy) NSString *nameSpace; + (NSString *)SIGNAL; + (NSString *)SIGNAL_TYPE; //- (void)handleUISignal:(XYUISignal *)signal; - (XYUISignal *)sendUISignal:(NSString *)name; - (XYUISignal *)sendUISignal:(NSString *)name withObject:(NSObject *)object; - (XYUISignal *)sendUISignal:(NSString *)name withObject:(NSObject *)object from:(id)source; - (XYUISignal *)sendUISignal:(NSString *)name withObject:(NSObject *)object from:(id)source to:(id)target; @end #pragma mark - XYUISignal(SourceView) @interface XYUISignal(SourceView) @property (nonatomic, readonly) UIView *sourceView; @property (nonatomic, readonly) UIViewController *sourceViewController; @end /* #pragma mark - NSObject(XYUISignal_delegate) // 此处扩展其它类也可以使用signal @interface NSObject(XYUISignal_delegate) @property (nonatomic, strong) NSMutableSet *XY_delegates; // 处理事件的委托集合, 和XY_deldgate不兼容 @property (nonatomic, weak) id XY_deldgate; // 处理事件的委托 @end */
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYBaseModel.h
<gh_stars>100-1000 // // XYBaseModel.h // JoinShow // // Created by Heaven on 14-4-25. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> #import "XYBaseDataSource.h" @interface XYBaseModel : NSObject <XYDataSource> // 读取数据 - (void)loadDataWith:(XYBaseDataSource *)dataGet; #pragma mark - m 对 c // 1 Notification // 2 KVO #pragma mark - c直接调用m // api @end
uxyheaven/XYQuick
Pod/Classes/core/extension/NSDate+XY.h
<reponame>uxyheaven/XYQuick<filename>Pod/Classes/core/extension/NSDate+XY.h // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #pragma mark - #define __XY_SECOND (1) #define __XY_MINUTE (60 * __XY_SECOND) #define __XY_HOUR (60 * __XY_MINUTE) #define __XY_DAY (24 * __XY_HOUR) #define __XY_MONTH (30 * __XY_DAY) @interface NSDate (XYExtension) @property (nonatomic, readonly) NSInteger uxy_year; @property (nonatomic, readonly) NSInteger uxy_month; @property (nonatomic, readonly) NSInteger uxy_day; @property (nonatomic, readonly) NSInteger uxy_hour; @property (nonatomic, readonly) NSInteger uxy_minute; @property (nonatomic, readonly) NSInteger uxy_second; @property (nonatomic, readonly) NSInteger uxy_weekday; @property (nonatomic, readonly) NSString *uxy_stringWeekday; // @"yyyy-MM-dd HH:mm:ss" - (NSString *)uxy_stringWithDateFormat:(NSString *)format; // 刚刚 %d分钟前 %d小时前 昨天 %d天前 %d个月前 %d年前 - (NSString *)uxy_timeAgo; + (long long)uxy_timeStamp; //+ (NSDate *)uxy_dateWithString:(NSString *)string; + (NSDate *)uxy_now; /// 返回day天后的日期(若day为负数,则为|day|天前的日期) - (NSDate *)uxy_dateAfterDay:(int)day; /// 返回距离aDate有多少天 - (NSInteger)uxy_distanceInDaysToDate:(NSDate *)aDate; /// UTC时间string缓存 @property (nonatomic, copy, readonly) NSString *uxy_stringCache; /// 重置缓存 - (NSString *)uxy_resetStringCache; /// 返回当地时区的时间 - (NSDate *)uxy_localTime; /** * @brief 返回日期格式器 * @return dateFormatter yyyy-MM-dd HH:mm:ss. dateFormatterByUTC 返回UTC格式的 */ + (NSDateFormatter *)uxy_dateFormatter; + (NSDateFormatter *)uxy_dateFormatterByUTC; + (NSDateFormatter *)uxy_dateFormatterWithFormatter:(NSString *)formatter; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/ImageVC.h
<reponame>uxyheaven/XYQuick // // ImageVC.h // JoinShow // // Created by Heaven on 13-10-25. // Copyright (c) 2013年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> #import "ViewControllerDemo.h" @interface ImageVC : UITableViewController<ViewControllerDemo> @property (nonatomic, strong) UIImage *originImg; @end
uxyheaven/XYQuick
Pod/Classes/ui/extension/UIImage+XY.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> #pragma mark - #define XY_USE_SYSTEM_IMAGE_CACHE NO /**************************************************************/ // UIImage @interface UIImage (XYExtension) /// 加载图片 used: imageWithContentsOfFile 自动带有2x 3x等后缀. 如果没有, 还是用默认的 + (UIImage *)uxy_imageWithFileName:(NSString *)name; /// 加载图片, 带缓存, used: imageWithContentsOfFile 自动带有2x 3x等后缀. 如果没有, 还是用默认的 + (UIImage *)uxy_imageNamed:(NSString *)name useCache:(BOOL)useCache; /// 圆形 - (UIImage *)uxy_rounded; /// 变成 尺寸circleRect的圆形 - (UIImage *)uxy_rounded:(CGRect)circleRect; /// 拉伸 - (UIImage *)uxy_stretched; /// 拉伸 - (UIImage *)uxy_stretched:(UIEdgeInsets)capInsets; /// 灰度 - (UIImage *)uxy_grayscale; /// 顺时针旋转angle度, 1是90度 - (UIImage *)uxy_rotate:(CGFloat)angle; /// 顺时针旋转90度 - (UIImage *)uxy_rotateCW90; /// 顺时针旋转180度 - (UIImage *)uxy_rotateCW180; /// 顺时针旋转27度 - (UIImage *)uxy_rotateCW270; /// 缩放到指定size - (UIImage*)uxy_scaleToSize:(CGSize)size; /// 创建并返回使用指定的图像中的颜色对象。 - (UIColor *)uxy_patternColor; /// 截取部分图像 - (UIImage *)uxy_crop:(CGRect)rect; /// 截取部分图像 - (UIImage *)uxy_imageInRect:(CGRect)rect; /// 从视频截取图片 + (UIImage *)uxy_imageFromVideo:(NSURL *)videoURL atTime:(CMTime)time scale:(CGFloat)scale; /// 叠加合并 + (UIImage *)uxy_merge:(NSArray *)images; /// 叠加合并 - (UIImage *)uxy_merge:(UIImage *)image; // 圆角 typedef enum { UXYImageRoundedCornerCornerTopLeft = 1, UXYImageRoundedCornerCornerTopRight = 1 << 1, UXYImageRoundedCornerCornerBottomRight = 1 << 2, UXYImageRoundedCornerCornerBottomLeft = 1 << 3 } UXYImageRoundedCornerCorner; /// 圆角 - (UIImage *)uxy_roundedRectWith:(float)radius; /// 圆角 - (UIImage *)uxy_roundedRectWith:(float)radius cornerMask:(UXYImageRoundedCornerCorner)cornerMask; /// 保存为png格式到path - (BOOL)uxy_saveAsPngWithPath:(NSString *)path; /// 保存为jpg格式到path, quality is 0(most)..1(least) - (BOOL)uxy_saveAsJpgWithPath:(NSString *)path compressionQuality:(CGFloat)quality; /// 保存到相册 - (void)uxy_saveAsPhotoWithPath:(NSString *)path; /// 高斯模糊 - (UIImage*)uxy_stackBlur:(NSUInteger)radius; /// 修复方向 - (UIImage *)uxy_fixOrientation; /// 改变图片颜色, Gradient带灰度 - (UIImage *)uxy_imageWithTintColor:(UIColor *)tintColor; - (UIImage *)uxy_imageWithGradientTintColor:(UIColor *)tintColor; /// 由颜色返回图片 + (UIImage *)uxy_imageWithColor:(UIColor *)color size:(CGSize)size; @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYBaseDao.h
<gh_stars>100-1000 // // XYBaseDao.h // JoinShow // // Created by Heaven on 14-9-10. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> #define XYBaseDao_error_code 123123 #define XYBaseDao_load_maxCount 1000 @protocol XYBaseDaoEntityProtocol <NSObject> @required // 返回表名 + (NSString *)getTableName; @optional // 返回主键 + (NSString *)getPrimaryKey; // 返回联合主键 + (NSArray *)getPrimaryKeyUnionArray; @end // 范化的本地dao类 @interface XYBaseDao : NSObject @property (nonatomic, weak, readonly) Class entityClass; + (instancetype)daoWithEntityClass:(Class)aClass; + (instancetype)daoWithEntityClassName:(NSString *)name; - (NSError *)saveEntity:(id)entity; - (NSError *)saveEntityWithArray:(NSArray *)array; - (id)loadEntityWithKey:(NSString *)key; - (NSArray *)loadEntityWithWhere:(NSString *)where order:(NSString *)order; - (NSArray *)loadEntityWithWhere:(NSString *)where order:(NSString *)order offset:(NSInteger)offset count:(NSInteger)count; - (NSInteger)countWithWhere:(NSString *)where; - (NSError *)deleteEntity:(id)entity; - (NSError *)deleteEntityWithKey:(NSString *)key; - (NSError *)deleteEntityWithWhere:(NSString *)where; - (void)deleteAllEntity; - (BOOL)isExistEntity:(id)entity; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/TestVC2.h
// // TestVC2.h // JoinShow // // Created by Heaven on 14-4-1. // Copyright (c) 2014年 Heaven. All rights reserved. // #pragma -mark todo #import <UIKit/UIKit.h> #import "ViewControllerDemo.h" @interface TestVC2 : UITableViewController<ViewControllerDemo> @property (nonatomic, strong) NSArray *items; @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYObjectCache.h
<gh_stars>100-1000 // // XYObjectCache.h // JoinShow // // Created by Heaven on 14-1-21. // Copyright (c) 2014年 Heaven. All rights reserved. // // Copy from bee Framework #import "XYQuick_Predefine.h" @class XYMemoryCache; @class XYFileCache; @interface XYObjectCache : NSObject uxy_as_singleton @property (nonatomic, weak, readonly) Class objectClass; // 缓存对象的类 @property (atomic, strong) XYMemoryCache *memoryCache;// 内存缓存 @property (atomic, strong) XYFileCache *fileCache;// 文件缓存 - (void)registerObjectClass:(Class)aClass; - (id)objectForKey:(NSString *)key; - (void)saveObject:(id)anObject forKey:(NSString *)key; - (void)deleteObjectForKey:(NSString *)key; - (void)deleteAllObjects; ////////////////////////////////////////////////////////////// - (BOOL)hasCachedForKey:(NSString *)key; - (BOOL)hasFileCachedForKey:(NSString *)key; - (BOOL)hasMemoryCachedForKey:(NSString *)key; - (id)fileObjectForKey:(NSString *)key; - (id)memoryObjectForKey:(NSString *)key; - (void)saveObject:(id)anObject forKey:(NSString *)key async:(BOOL)async; - (void)saveToMemory:(id)anObject forKey:(NSString *)key; - (void)saveToData:(NSData *)data forKey:(NSString *)key; @end @protocol XYObjectCacheDelegate <NSObject> @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/IndicatorHelper.h
<gh_stars>100-1000 // // IndicatorHelper.h // JoinShow // // Created by Heaven on 14-6-11. // Copyright (c) 2014年 Heaven. All rights reserved. // // 指示器帮助类 #import "XYQuick_Predefine.h" // MBProgressHUD指示器 #import "MBProgressHUD.h" @interface IndicatorHelper : NSObject uxy_as_singleton // 返回一个indicatorView + (id)indicatorView; // apple原生的UIActivityIndicatorView + (id)originalIndicator; + (id)MBProgressHUD; // - (id)message:(NSString *)message; - (id)inView:(UIView *)view; - (id)show; - (NSTimeInterval)displayDurationForString:(NSString *)str; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/SignalVC.h
<gh_stars>100-1000 // // UISignalVC.h // JoinShow // // Created by Heaven on 14-5-20. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> #import "XYQuick.h" #import "XYSignal.h" #import "ViewControllerDemo.h" uxy_as_def_signal( signal_name1 ) // 信号1 @interface Signal1 : UIView @end @interface Signal2 : UIView @property (nonatomic, strong) UIButton *btn; @end @interface Signal2_child : Signal2 @end @interface SignalVC : UIViewController<ViewControllerDemo> @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYRepository.h
// // XYRepository.h // // Created by heaven on 15/4/29. // Copyright (c) 2015年 heaven. All rights reserved. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> @class XYRepositoryInterface; @class XYRepositoryEvent; @protocol XYRepositoryProtocol <NSObject> - (void)XYRepositoryWithDataIdentifier:(NSString *)identifier event:(XYRepositoryEvent *)event; @end typedef void (^XYRepositoryCompletedBlock)(XYRepositoryEvent *event); // 模块合作接口 @interface XYRepositoryInterface : NSObject @property (nonatomic, weak) id receiver; @property (nonatomic, assign) Class receiverClass; @property (nonatomic, copy) NSString *identifier; @end // 模块合作事件 @interface XYRepositoryEvent : NSObject // Request @property (nonatomic, strong) XYRepositoryInterface *interface; @property (nonatomic, copy) XYRepositoryCompletedBlock completedBlock; // 完成后的回调 // Response @property (nonatomic, assign) BOOL isAsync; // 是否异步 @property (nonatomic, strong) id data; // 数据 @property (nonatomic, strong) NSError *error; // 错误信息 @end #pragma mark - 聚合 @interface XYAggregate : NSObject @property (nonatomic, copy, readonly) NSString *key; @property (nonatomic, weak) id root; // 如果你不是这个对象的持有者,最好不要改变他本身 @end #pragma mark - // 资源库 @interface XYRepository : NSObject @property (nonatomic, copy, readonly) NSString *domain; #pragma mark - 注册相关 // 注册一个数据标识 - (void)registerDataAtIdentifier:(NSString *)identifier receiver:(id <XYRepositoryProtocol>)receiver; - (void)registerDataAtIdentifier:(NSString *)identifier receiverClassName:(NSString *)className; #pragma mark - 获取相关 // 获取数据 - (XYRepositoryEvent *)invocationDataIndentifier:(NSString *)identifier completedBlock:(XYRepositoryCompletedBlock)block; + (instancetype)repositoryWithDomain:(NSString *)domain; - (XYAggregate *)aggregateForKey:(NSString *)key; - (void)setAnAggregateRoot:(id)root forKey:(NSString *)key; - (void)removeAggregateForKey:(NSString *)key; @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYBaseDataSource.h
// // XYBaseDataSource.h // JoinShow // // Created by Heaven on 14/11/4. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> #define ON_DATA_SUCCEED_1_( __DataSource, __data ) \ - (void)dataSource:(id)__DataSource didGetData:(id)__data; #define ON_DATA_FAILED_1_( __DataSource, __error ) \ - (void)dataSource:(id)__DataSourcet error:(NSError *)__error; #define ON_DATA_SUCCEED_2_( __filter, __DataSource, __data ) \ - (void)## __filter##_DataSource:(id)__DataSource didGetData:(id)__data; #define ON_DATA_FAILED_2_( __filter, __DataSource, __error ) \ - (void)##__filter##_DataSource:(id)__DataSourcet error:(NSError *)__error; @protocol XYDataSource <NSObject> // 获取数据成功 - (void)dataSource:(id)dataSource didUpdateData:(id)data; // 获取数据失败 - (void)dataSource:(id)dataSource error:(NSError *)error; @optional // 状态切换 //- (void)dataSource:(id)dataSource state:(NSInteger)state text:(NSString *)text; @end @interface XYBaseDataSource : NSObject @property (nonatomic, assign, readonly) int state; @property (nonatomic, weak) id <XYDataSource> delegate; @property (nonatomic, copy) NSString *filter; // 过滤 // 开始获取数据 - (void)startGetData; @end #pragma mark - XYFileDataSource @interface XYFileDataSource : XYBaseDataSource @property (nonatomic, copy) NSString *fileKey; // 必须设置key @property (nonatomic, weak) Class dataClass; // 如果设置dataClass, 就用这个类去解析 + (id)fileDataSourceWithDelegate:(id)delegate fileKey:(NSString *)key; @end #pragma mark - XYDBDataSource @interface XYDBDataSource : XYBaseDataSource @property (nonatomic, weak) Class dataClass; // 数据类型, 必须设置 @property (nonatomic, copy) NSString *where; // 查询条件 @property (nonatomic, copy) NSString *order; // 排序 @property (nonatomic, assign) NSInteger offset; // 偏移, 默认0 @property (nonatomic, assign) NSInteger count; // 数量, 默认 20 + (id)dbDataSourceWithDelegate:(id)delegate dataClass:(Class)dataClass; @end #pragma mark - XYNetDataSource @interface XYNetDataSource : XYBaseDataSource @property (nonatomic, copy) NSString *path; // 路径 @property (nonatomic, copy) NSString *host; // host @property (nonatomic, strong) NSDictionary *params; // 参数 @property (nonatomic, copy) NSString *httpMethod; // 默认get @property (nonatomic, assign) BOOL usedCache; // 使用缓存 @end
uxyheaven/XYQuick
Example/XYQuick/View/Test2View.h
// // Test2View.h // JoinShow // // Created by Heaven on 13-7-31. // Copyright (c) 2013年 Heaven. All rights reserved. // #import "TestView.h" @interface Test2View : TestView @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYApplicationWorkspace.h
// // XYApplicationWorkspace.h // JoinShow // // Created by Heaven on 15/8/5. // Copyright (c) 2015年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> @interface XYApplicationWorkspace : NSObject - (NSArray *)allApplications; @end
uxyheaven/XYQuick
Example/XYQuick/Model/AopTestM.h
// // AopTestM.h // JoinShow // // Created by Heaven on 14/10/28. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> @interface AopTestM : NSObject - (NSString *)sumA:(int)a andB:(int)b; @end
uxyheaven/XYQuick
Pod/Classes/core/modules/XYRuntime.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #pragma mark - #define XYRuntime_SORT 0 // 对返回的类,方法进行排序(1开启, 0关闭) @interface XYRuntime : NSObject /** * @brief 移魂大法 * @param clazz 原方法的类 * @param original 原方法 * @param replacement 劫持后的方法 */ + (void)swizzleInstanceMethodWithClass:(Class)clazz originalSel:(SEL)original replacementSel:(SEL)replacement; /** * @brief 返回需要过滤的类. iOS有个bug, 某些类一旦被枚举就会crash, 如NSHTMLReader. 我已经过滤了一些, 但是难免有遗漏, 如果遇到了新的, 请写个类别在这里过滤. 已经过滤的如下: @"NSHTMLReader", @"PAHybridRouter", @"FBSDKAppLinkResolver", @"FBSDKAppInviteDialog", @"FBSDKShareDialog", @"FBSDKMessageDialog", @"WKNSURLRequest", @"WKNSURLAuthenticationChallenge", @"WKNSURL", @"WKNSString", @"WKNSError", */ + (NSSet *)customClassFilter; @end #pragma mark - #undef uxy_class #define uxy_class( x ) NSClassFromString(@ #x) #undef uxy_instance #define uxy_instance( x ) [[NSClassFromString(@ #x) alloc] init] #pragma mark - @interface NSObject (uxyRuntime) // class + (NSArray *)uxy_subClasses; + (NSArray *)uxy_classesWithProtocol:(NSString *)protocolName; // method + (NSArray *)uxy_methods; + (NSArray *)uxy_methodsWithPrefix:(NSString *)prefix; + (NSArray *)uxy_methodsUntilClass:(Class)baseClass; + (NSArray *)uxy_methodsWithPrefix:(NSString *)prefix untilClass:(Class)baseClass; + (void *)uxy_replaceSelector:(SEL)sel1 withSelector:(SEL)sel2; // property + (NSArray *)uxy_properties; + (NSArray *)uxy_propertiesUntilClass:(Class)baseClass; + (NSArray *)uxy_propertiesWithPrefix:(NSString *)prefix; + (NSArray *)uxy_propertiesWithPrefix:(NSString *)prefix untilClass:(Class)baseClass; @end
uxyheaven/XYQuick
Example/XYQuick/Model/CarEntity.h
// // CarEntity.h // JoinShow // // Created by Heaven on 14-9-12. // Copyright (c) 2014年 Heaven. All rights reserved. // // 测试XYBaseDao用 #import <Foundation/Foundation.h> #import "XYBaseDao.h" @interface CarEntity : NSObject @property (nonatomic, copy) NSString *name; @property (nonatomic, copy) NSString *brand; @property (nonatomic, assign) NSInteger time; @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYClassLoader.h
// // XYClassLoader.h // JoinShow // // Created by heaven on 15/4/22. // Copyright (c) 2015年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> @interface NSObject(XYClassLoader) + (void)uxy_classAutoLoad; @end #pragma mark - @interface XYClassLoader : NSObject + (instancetype)classLoader; - (void)loadClasses:(NSArray *)classNames; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/TestVC.h
// // TestVC.h // JoinShow // // Created by Heaven on 13-9-1. // Copyright (c) 2013年 Heaven. All rights reserved. // // 此页面 测试用 #import "ViewControllerDemo.h" @class XYObserve; @class TestView; @class GirlEntity; @interface TestVC : UIViewController<ViewControllerDemo> { int offset; } @property (nonatomic, strong) NSMutableArray *array; @property (nonatomic, assign) int testKVO; @property (nonatomic, assign) BOOL testKVO_BOOL; @property (nonatomic, assign) int testKVO2; @property (nonatomic, strong) NSMutableArray *testArrayKVO; @property (nonatomic, strong) GirlEntity *myGirl; @property (nonatomic, strong) TestView *testView; @property (nonatomic, strong) NSString *text; - (IBAction)clickBtn1:(id)sender; - (IBAction)clickBtn2:(id)sender; - (IBAction)clickAVSpeech:(id)sender; - (IBAction)clickOnce:(id)sender; - (IBAction)clickOnce2:(id)sender; @end
uxyheaven/XYQuick
Pod/Classes/core/modules/XYSandbox.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #pragma mark - @interface XYSandbox : NSObject + (instancetype)sharedInstance; + (void)purgeSharedInstance; @property (nonatomic, readonly, copy) NSString *appPath; @property (nonatomic, readonly, copy) NSString *docPath; @property (nonatomic, readonly, copy) NSString *libPrefPath; @property (nonatomic, readonly, copy) NSString *libCachePath; @property (nonatomic, readonly, copy) NSString *tmpPath; /// 程序目录,不能存任何东西 + (NSString *)appPath; /// 文档目录,需要ITUNES同步备份的数据存这里 + (NSString *)docPath; /// 配置目录,配置文件存这里 + (NSString *)libPrefPath; /// 缓存目录,系统在磁盘空间不足的情况下会删除里面的文件,iTunes会删除 + (NSString *)libCachePath; /// 缓存目录,APP退出后,系统可能会删除这里的内容 + (NSString *)tmpPath; /// 返回目标的资源目录 + (NSString *)resPath:(NSString *)file; /// 如果目标文件夹不存在, 创建一个空文件夹 + (BOOL)touchDirectory:(NSString *)path; /// 如果目标文件不存在, 创建一个空文件 + (BOOL)touchFile:(NSString *)file; /// 返回文件的MD5 + (NSString *)fileMD5:(NSString *)path; /** * 返回目下所有给定后缀的文件的方法 * api parameters 说明 * * direString 目录绝对路径 * fileType 文件后缀名 * operation (预留,暂时没用) */ + (NSArray *)allFilesAtPath:(NSString *)direString type:(NSString*)fileType operation:(int)operation; /** * 返回目录文件的size,单位字节 * api parameters 说明 * * filePath 目录路径 * diskMode 是否是磁盘占用的size */ + (uint64_t)sizeAtPath:(NSString *)filePath diskMode:(BOOL)diskMode; /// 设置目录里的文件不备份 + (BOOL)skipFileBackupForItemAtURL:(NSURL *)URL; @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/module/XYModuleManager.h
// // XYModuleManager.h // XYQuick // // Created by heaven on 2016/12/20. // Copyright © 2016年 xingyao095. All rights reserved. // #import <Foundation/Foundation.h> @interface XYModuleManager : NSObject + (instancetype)sharedInstance; - (void)hookAppDelegate:(id <UIApplicationDelegate>)appDelegate; - (void)addAModule:(id)module; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/KeyboardVC.h
// // KeyboardVC.h // JoinShow // // Created by Heaven on 13-10-29. // Copyright (c) 2013年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> #import "ViewControllerDemo.h" @interface KeyboardVC : UIViewController <UITextFieldDelegate, UITextViewDelegate, ViewControllerDemo>{ NSInteger selectedTextFieldTag; } - (IBAction)clickEnable:(id)sender; - (IBAction)clickDisable:(id)sender; - (IBAction)clickPop:(id)sender; @end
uxyheaven/XYQuick
Example/XYQuick/Model/JsonTestEntity.h
<gh_stars>100-1000 // // JsonTestEntity.h // JoinShow // // Created by Heaven on 14-4-24. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> @interface JsonTestEntity : NSObject @property (nonatomic, strong) NSArray *array; @property (nonatomic, strong) NSDictionary *dic; @end
uxyheaven/XYQuick
Pod/Classes/ui/modules/XYTabBar.h
<gh_stars>100-1000 // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <UIKit/UIKit.h> #pragma mark - @protocol XYTabBarDelegate; @interface XYTabBar : UIView #pragma mark- data // 定义data #pragma mark- view // 定义view @property (nonatomic, strong, readonly) NSMutableArray *items; // 选项 @property (nonatomic, strong, readonly) UIImageView *backgroundView; // 背景 @property (nonatomic, strong) UIImageView *animatedView; // 选中item时的图片 #pragma mark - v对c // 1 target-action // 2 delegate(should, will, did) @property (nonatomic, weak) id<XYTabBarDelegate> delegate; // 3 dataSource(count, data at) @property (nonatomic, weak) id dataSource; #pragma mark- c直接调用 // Outlet // item: @{@"normal" :img1, @"highlighted" :img2, @"selected" :img3, @"disabled":img4, @"text": text} - (id)initWithFrame:(CGRect)frame items:(NSArray *)items; - (void)selectTabAtIndex:(NSInteger)index; - (void)setBackgroundImage:(UIImage *)img; //- (void)removeTabAtIndex:(NSInteger)index; //- (void)insertTabWithImageDic:(NSDictionary *)dict atIndex:(NSUInteger)index; // 在这里设置item的位置和图片文字尺寸 - (void)setupItem:(UIButton *)item index:(NSInteger)index; // 在这里设置animatedView的位置 - (void)resetAnimatedView:(UIImageView *)animatedView index:(NSInteger)index; @end @protocol XYTabBarDelegate<NSObject> @optional - (BOOL)tabBar:(XYTabBar *)tabBar shouldSelectIndex:(NSInteger)index; - (void)tabBar:(XYTabBar *)tabBar didSelectIndex:(NSInteger)index; - (void)tabBar:(XYTabBar *)tabBar animatedView:(UIImageView *)animatedView item:(UIButton *)item index:(NSInteger)index; @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYAppController.h
// // XYAppController.h // JoinShow // // Created by heaven on 15/4/22. // Copyright (c) 2015年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> #import "XYQuick_Predefine.h" // AppDelegate流程控制类 @interface XYAppController : NSObject uxy_as_singleton // 待补全 // 单例有问题 #pragma mark- rewrite下列方法实现控制流程的一些重载 - (void)before_application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; - (void)after_application_didFinishLaunchingWithOptions; @end
uxyheaven/XYQuick
Example/XYQuick/Model/GirlEntity.h
<reponame>uxyheaven/XYQuick // // GirlEntity.h // JoinShow // // Created by Heaven on 14-1-13. // Copyright (c) 2014年 Heaven. All rights reserved. // // 测试runtime 时候用的 #import <UIKit/UIKit.h> @interface GirlEntity : NSObject @property (nonatomic, copy) NSString *name; - (void)talk; @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYBaseView.h
// // XYBaseView.h // JoinShow // // Created by Heaven on 14-4-25. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> @interface XYBaseView : UIView #pragma mark- as #pragma mark- model #pragma mark- view #pragma mark- api @end
uxyheaven/XYQuick
Example/XYQuick/Model/ConfigManager.h
// // ConfigManager.h // JoinShow // // Created by Heaven on 13-9-10. // Copyright (c) 2013年 Heaven. All rights reserved. // #import "XYQuick.h" @interface ConfigManager : NSObject uxy_as_singleton @property (nonatomic, strong) NSString *StrTest; @end
uxyheaven/XYQuick
Example/XYQuick/Modules/ModuleA.h
<reponame>uxyheaven/XYQuick // // ModuleA.h // XYQuick // // Created by heaven on 2016/12/21. // Copyright © 2016年 xingyao095. All rights reserved. // #import "XYModuleLifecycle.h" @interface ModuleA : XYModuleLifecycle + (instancetype)sharedInstance; @end
uxyheaven/XYQuick
Pod/Classes/core/XYQuick_Core.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import <Foundation/Foundation.h> // Modules #import "XYThread.h" // GCD #import "XYTimer.h" // 定时器 #import "XYSystemInfo.h" // 系统信息 #import "XYSandbox.h" // 沙箱 #import "XYJSON.h" // json to object , object to json #import "XYAOP.h" // aop #import "XYRuntime.h" // runtime #import "XYBlackMagic.h" // 黑魔法 #import "XYReachability.h" // 网络可达性检测 #import "XYBaseBuilder.h" // 通用建造者 #import "XYCommonDefine.h" #import "XYCommon.h" // 待分解 #import "XYQuick_Cache.h" // 缓存模块 #import "XYQuick_Debug.h" // 调试模块 // Extensions #import "NSObject+XY.h" #import "NSArray+XY.h" #import "NSDictionary+XY.h" #import "NSString+XY.h" #import "NSData+XY.h" #import "NSDate+XY.h" #import "NSNumber+XY.h" #import "NSSet+XY.h" #import "NSNull+XY.h"
uxyheaven/XYQuick
Example/XYQuick/Laboratory/module/XYInterfaceManager.h
// // XYInterfaceManager.h // XYQuick // // Created by heaven on 2016/12/22. // Copyright © 2016年 xingyao095. All rights reserved. // #import <Foundation/Foundation.h> @interface XYInterfaceManager : NSObject /* * sel : create * sel : retrieve * sel : update * sel : delete * completion : {ret : 1, error : error, data : data } * resourceDoActionWithJSON("达人", retrieve, {达人id = 1}); * resourceDoActionWithJSON("达人列表", retrieve, {count = 10}); */ + (void)resource:(NSString *)resource doAction:(SEL)sel withJSON:(id)json success:(void (^)(id data))success failure:(void (^)(NSError *error))failure; @end
uxyheaven/XYQuick
Example/XYQuick/View/TestView.h
<reponame>uxyheaven/XYQuick<filename>Example/XYQuick/View/TestView.h // // TestView.h // JoinShow // // Created by Heaven on 13-7-31. // Copyright (c) 2013年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> @interface TestView : UIView @property (nonatomic, strong) UILabel *label1; @property (nonatomic, strong) UIImageView *img1; - (void)test; @end
uxyheaven/XYQuick
Pod/Classes/ui/modules/XYAnimate.h
<filename>Pod/Classes/ui/modules/XYAnimate.h // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #pragma mark - typedef void (^XYAnimateStepBlock)(void); @interface XYAnimate : NSObject @end ////////////////////// XYAnimateStep /////////////////////// @interface XYAnimateStep : NSObject + (id)duration:(NSTimeInterval)duration animate:(XYAnimateStepBlock)step; + (id)delay:(NSTimeInterval)delay duration:(NSTimeInterval)duration animate:(XYAnimateStepBlock)step; + (id)delay:(NSTimeInterval)delay duration:(NSTimeInterval)duration option:(UIViewAnimationOptions)option animate:(XYAnimateStepBlock)step; @property (nonatomic, assign) NSTimeInterval delay; @property (nonatomic, assign) NSTimeInterval duration; @property (nonatomic, copy ) XYAnimateStepBlock step; @property (nonatomic, assign) UIViewAnimationOptions option; - (void)runAnimated:(BOOL)animated; - (void)run; @end ////////////////////// XYAnimateSerialStep /////////////////////// // 串行 序列 Serial Sequence @interface XYAnimateSerialStep : XYAnimateStep @property (nonatomic, strong, readonly) NSArray* steps; + (id)animate; - (id)addStep:(XYAnimateStep *)aStep; @end ////////////////////// XYAnimateParallelStep /////////////////////// // 并行 序列 Parallel Spawn @interface XYAnimateParallelStep : XYAnimateStep @property (nonatomic, strong, readonly) NSArray* steps; + (id)animate; - (id)addStep:(XYAnimateStep *)aStep; @end
uxyheaven/XYQuick
Pod/Classes/event/modules/XYKVO.h
<reponame>uxyheaven/XYQuick // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #pragma mark - #pragma mark - #define // 响应一个KVO属性 #define uxy_handleKVO( __property, __sourceObject, ...) \ metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \ (__uxy_handleKVO_1(__property, __sourceObject, __VA_ARGS__)) \ (__uxy_handleKVO_2(__property, __sourceObject, __VA_ARGS__)) #define __uxy_handleKVO_1( __property, __sourceObject, __newValue) \ - (void)__uxy_handleKVO_##__property##_in:(id)sourceObject new:(id)newValue #define __uxy_handleKVO_2( __property, __sourceObject, __newValue, __oldValue ) \ - (void)__uxy_handleKVO_##__property##_in:(id)sourceObject new:(id)newValue old:(id)oldValue typedef void(^XYKVO_block_new_old)(id newValue, id oldValue); #pragma mark - XYKVO @interface XYKVO : NSObject @end #pragma mark - NSObject (XYObserve) // 注意这里是 self 持有了观察者, 在 self 销毁的时候, 取消所有的观察 @interface NSObject (XYKVO) @property (nonatomic, readonly, strong) NSMutableDictionary *uxy_KVO; /** * api parameters 说明 * * sourceObject 被观察的对象 * keyPath 被观察的属性keypath * target 默认是self * block selector, block二选一 */ - (void)uxy_observeWithObject:(id)sourceObject property:(NSString *)property; - (void)uxy_observeWithObject:(id)sourceObject property:(NSString *)property block:(XYKVO_block_new_old)block; - (void)uxy_removeObserverWithObject:(id)sourceObject property:(NSString *)property; - (void)uxy_removeObserverWithObject:(id)sourceObject; - (void)uxy_removeAllObserver; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/JSONVC.h
<filename>Example/XYQuick/Controller/JSONVC.h<gh_stars>100-1000 // // JSONVC.h // JoinShow // // Created by Heaven on 14-9-9. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> #import "ViewControllerDemo.h" @interface JSONVC : UITableViewController<ViewControllerDemo> @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYMenuItem.h
<reponame>uxyheaven/XYQuick // // XYMenuItem.h // JoinShow // // Created by heaven on 14/12/11. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> @protocol XYMenuItem <NSObject> @optional @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSString *icon; @property (nonatomic, copy) NSString *backgroundImage; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/AnimationVC2.h
// // AnimationVC2.h // JoinShow // // Created by Heaven on 13-11-19. // Copyright (c) 2013年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> #import "ViewControllerDemo.h" @interface AnimationVC2 : UIViewController<ViewControllerDemo> @end
uxyheaven/XYQuick
Example/XYQuick/Model/EntityBaseModel.h
<filename>Example/XYQuick/Model/EntityBaseModel.h // // EntityModel.h // JoinShow // // Created by Heaven on 13-12-10. // Copyright (c) 2013年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> #import "XYQuick.h" @class RequestHelper; @class LKDBHelper; @protocol EntityModelDelegate; @interface EntityBaseModel : NSObject{ //@public id <EntityModelDelegate> _delegate; } //AS_SINGLETON(EntityModel) @property (nonatomic, strong) id data; // 数据 @property (nonatomic, assign) Class dataClass; // 数据类型 @property (nonatomic, strong) id result; // 临时数据 @property (nonatomic, strong, readonly) NSMutableArray *array; // array @property (nonatomic, strong, readonly) NSMutableDictionary *dic; // dic @property (nonatomic, assign) int tag; // 标签 @property (nonatomic, strong) RequestHelper *requestHelper; // 网络请求,需要自己初始化 @property (nonatomic, strong) LKDBHelper *dbHelper; // 数据库帮助类 #pragma mark - +(id) modelWithClass:(Class)aClass; #pragma mark - net //- (void)loadFromServer/ #pragma mark - database //- (void)loadFromDatabase - (void)addObject:(id)anObject; - (void)insertObject:(id)anObject atIndex:(NSUInteger)index; - (void)removeLastObject; - (void)removeObjectAtIndex:(NSUInteger)index; @end
uxyheaven/XYQuick
Pod/Classes/core/extension/NSObject+XY.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #pragma mark - @interface NSObject (XYExtension) #pragma mark - property // 属性列表 @property (nonatomic, readonly, strong) NSArray *uxy_attributeList; #pragma mark - conversion - (NSInteger)uxy_asInteger; // NSNumber, NSNull, NSString, NSString, NSDate - (float)uxy_asFloat; // NSNumber, NSNull, NSString, NSString, NSDate - (BOOL)uxy_asBool; // NSNumber, NSNull, NSString, NSString, NSDate - (NSNumber *)uxy_asNSNumber; // NSNumber, NSNull, NSString, NSString, NSDate - (NSString *)uxy_asNSString; // NSString, NSNull, NSData - (NSDate *)uxy_asNSDate; // NSDate, NSString, - (NSData *)uxy_asNSData; // NSData, NSString - (NSArray *)uxy_asNSArray; // NSArray, NSObject #pragma mark- copy - (id)uxy_deepCopy1; // 基于NSKeyArchive @end #pragma mark- XY_associated #define uxy_property_strong( __type, __name) \ property (nonatomic, strong, setter=set__##__name:, getter=__##__name) __type __name; #define uxy_def_property_strong( __type, __name) \ - (__type)__##__name \ { return [self uxy_getAssociatedObjectForKey:#__name]; } \ - (void)set__##__name:(id)__##__name \ { [self uxy_setRetainAssociatedObject:(id)__##__name forKey:#__name]; } #define uxy_property_weak( __type, __name) \ property (nonatomic, weak, setter=set__##__name:, getter=__##__name) __type __name; #define uxy_def_property_weak( __type, __name) \ - (__type)__##__name \ { return [self uxy_getAssociatedObjectForKey:#__name]; } \ - (void)set__##__name:(id)__##__name \ { [self uxy_setAssignAssociatedObject:(id)__##__name forKey:#__name]; } #define uxy_property_copy( __type, __name) \ property (nonatomic, copy, setter=set__##__name:, getter=__##__name) __type __name; #define uxy_def_property_copy( __type, __name) \ - (__type)__##__name \ { return [self uxy_getAssociatedObjectForKey:#__name]; } \ - (void)set__##__name:(id)__##__name \ { [self uxy_setCopyAssociatedObject:(id)__##__name forKey:#__name]; } #define uxy_property_retain( __type, __name) \ property (nonatomic, retain, setter=set__##__name:, getter=__##__name) __type __name; #define uxy_def_property_retain( __type, __name) \ - (__type)__##__name \ { return [self uxy_getAssociatedObjectForKey:#__name]; } \ - (void)set__##__name:(id)__##__name \ { [self uxy_setRetainAssociatedObject:(id)__##__name forKey:#__name]; } #define uxy_property_assign( __type, __name) \ property (nonatomic, assign, setter=set__##__name:, getter=__##__name) __type __name; #define uxy_def_property_assign( __type, __name) \ - (__type)__##__name \ { return [self uxy_getAssociatedObjectForKey:#__name]; } \ - (void)set__##__name:(id)__##__name \ { [self uxy_setAssignAssociatedObject:(id)__##__name forKey:#__name]; } #define uxy_property_basicDataType( __type, __name) \ property (nonatomic, assign, setter=set__##__name:, getter=__##__name) __type __name; #define uxy_def_property_basicDataType( __type, __name) \ - (__type)__##__name \ { \ NSNumber *number = [self uxy_getAssociatedObjectForKey:#__name]; \ return metamacro_concat(metamacro_concat(__uxy_, __type), _value)( number ); \ } \ - (void)set__##__name:(__type)__##__name \ { \ NSNumber *number = @(__##__name);\ [self uxy_setRetainAssociatedObject:number forKey:#__name]; \ } #define __uxy_int_value( __nubmer ) [__nubmer intValue] #define __uxy_char_value( __nubmer ) [__nubmer charValue] #define __uxy_short_value( __nubmer ) [__nubmer shortValue] #define __uxy_long_value( __nubmer ) [__nubmer longValue] #define __uxy_float_value( __nubmer ) [__nubmer floatValue] #define __uxy_double_value( __nubmer ) [__nubmer doubleValue] #define __uxy_BOOL_value( __nubmer ) [__nubmer boolValue] #define __uxy_NSInteger_value( __nubmer ) [__nubmer integerValue] #define __uxy_NSUInteger_value( __nubmer ) [__nubmer unsignedIntegerValue] #define __uxy_NSTimeInterval_value( __nubmer ) [__nubmer doubleValue] // 关联对象OBJC_ASSOCIATION_ASSIGN策略不支 持引用计数为0的弱引用 @interface NSObject (XY_associated) - (id)uxy_getAssociatedObjectForKey:(const char *)key; - (void)uxy_setCopyAssociatedObject:(id)obj forKey:(const char *)key; - (void)uxy_setRetainAssociatedObject:(id)obj forKey:(const char *)key; - (void)uxy_setAssignAssociatedObject:(id)obj forKey:(const char *)key; - (void)uxy_removeAssociatedObjectForKey:(const char *)key; - (void)uxy_removeAllAssociatedObjects; @end
uxyheaven/XYQuick
Pod/Classes/core/modules/XYCommonDefine.h
<reponame>uxyheaven/XYQuick // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #pragma mark - /**************************************************************/ // delegate 委托 // arm64下失效,具体看https://developer.apple.com/library/ios/documentation/General/Conceptual/CocoaTouch64BitGuide/ConvertingYourAppto64-Bit/ConvertingYourAppto64-Bit.html /* #define DelegateSelf( __sel ) Delegate( __sel, self) // delegate被注册KVO时,isa会变, 判断delegate被释放? // arm64下面 objc_msgSend不能用__VA_ARGS__了 #define Delegate( __sel, ...) \ if (_delegate && [_delegate respondsToSelector:__sel]) \ { \ __actionXY_return_void = (void (*)(id, SEL, ...)) objc_msgSend; \ __actionXY_return_void(_delegate, __sel, ## __VA_ARGS__); \ } */ /**************************************************************/ // block 安全self #if __has_feature(objc_arc) // arc #define uxy_def_weakSelf uxy_def_weakify(self) #define uxy_def_strongSelf uxy_def_strongify(self) #define uxy_def_weakify( __object ) \ __weak __typeof( __object) weak##_##__object = __object; #define uxy_def_strongify( __object ) \ __typeof__(__object) __object = weak##_##__object; #else // mrc #define uxy_def_weakSelf __block typeof(id) weakSelf = self; #define uxy_def_strongSelf #define uxy_def_weakify( __object ) \ __block __typeof(__object) block##_##__object = __object; #define uxy_def_strongify( __object ) #endif /**************************************************************/ // arc mrc 兼容 #if __has_feature(objc_arc) #define UXY_AUTORELEASE(exp) exp #define UXY_RELEASE(exp) exp #define UXY_RETAIN(exp) exp #else #define UXY_AUTORELEASE(exp) [exp autorelease] #define UXY_RELEASE(exp) [exp release] #define UXY_RETAIN(exp) [exp retain] #endif /**************************************************************/ // 方法定义 //void (*__actionXY)(id, SEL, ...) = (void (*)(id, SEL, ...))objc_msgSend; //void (*__actionXY_return_void)(id, SEL, ...); //id (*__actionXY_return_id)(id, SEL, ...); /**************************************************************/ // 主线程下同步会造成死锁 #undef dispatch_main_sync_safe #define dispatch_main_sync_safe(block)\ if ([NSThread isMainThread]) {\ block();\ } else {\ dispatch_sync(dispatch_get_main_queue(), block);\ } #undef dispatch_main_async_safe #define dispatch_main_async_safe(block)\ if ([NSThread isMainThread]) {\ block();\ } else {\ dispatch_async(dispatch_get_main_queue(), block);\ } /**************************************************************/ // 限制循环的最大次数, 到了后就跳出 #define uxy_loop_lomit( __maxCount ) \ { NSUInteger __xy_count; if (__xy_count++ > __maxCount) { break; } } /**************************************************************/ #pragma mark -end
uxyheaven/XYQuick
Pod/Classes/predefine/XYQuick_Predefine.h
<filename>Pod/Classes/predefine/XYQuick_Predefine.h // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef __XYQUICK_PREDEFINE_H__ #define __XYQUICK_PREDEFINE_H__ #undef __XYQUICK_VERSION__ #define __XYQUICK_VERSION__ "0.9.10" // 主版本号 // ---------------------------------- // on-off // ---------------------------------- #define __XYQuick_Framework__ (0) // 打包,暂时无用 #ifdef DEBUG #define __XY_DEBUG__ (1) // 调试 #define __XY_PERFORMANCE__ (1) // 性能测试 #define __XY_DEBUG_SHOWBORDER__ (1) // 点击区域红色边框 #define __XY_DEBUG_UNITTESTING__ (1) // 单元测试 #define __XY_DEBUG_DEBUGLABEL__ (1) // 调试的label #else #define __XY_DEBUG__ (0) // 调试 #define __XY_PERFORMANCE__ (0) // 性能测试 #define __XY_DEBUG_SHOWBORDER__ (0) // 点击区域红色边框 #define __XY_DEBUG_UNITTESTING__ (0) // 单元测试 #define __XY_DEBUG_DEBUGLABEL__ (0) // 调试的label #endif // ---------------------------------- // header.h // ---------------------------------- // ---------------------------------- // Common use macros // ---------------------------------- #ifndef IN #define IN #endif #ifndef OUT #define OUT #endif #ifndef INOUT #define INOUT #endif #ifndef UNUSED #define UNUSED(__x) { id __unused_var__ __attribute__((unused)) = (id)(__x); } #endif #ifndef ALIAS #define ALIAS(__a, __b) __typeof__(__a) __b = __a; #endif #ifndef DEPRECATED #define DEPRECATED __attribute__((deprecated)) #endif #ifndef XY_TODO #define XY_TODO(X) _Pragma(uxy_macro_cstr(message("✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖ TODO: " X))) #endif #ifndef EXTERN_C #if defined(__cplusplus) #define EXTERN_C extern "C" #else #define EXTERN_C extern #endif #endif #ifndef INLINE #define INLINE __inline__ __attribute__((always_inline)) #endif // ---------------------------------- // Code block // ---------------------------------- // 单例模式 #define XYSINGLETON static id sharedInstance; #define uxy_as_singleton \ + (instancetype)sharedInstance; \ + (void)purgeSharedInstance; #define uxy_def_singleton(__token) \ static id __singleton__objc__ ## __token; \ static dispatch_once_t __singleton__token__ ## __token; \ + (instancetype)sharedInstance \ { \ dispatch_once(&__singleton__token__ ## __token, ^{ __singleton__objc__ ## __token = [[self alloc] init]; }); \ return __singleton__objc__ ## __token; \ } \ + (void)purgeSharedInstance \ { \ __singleton__objc__ ## __token = nil; \ __singleton__token__ ## __token = 0; \ } // 执行一次 #define uxy_once_begin(__name) \ static dispatch_once_t once_ ## __name; \ dispatch_once(&once_ ## __name, ^ { #define uxy_once_end }); // ---------------------------------- // Category // ---------------------------------- //使用示例: //UIColor+YYAdd.m /* #import "UIColor+YYAdd.h" DUMMY_CLASS(UIColor+YYAdd) @implementation UIColor(YYAdd) ... @end */ #ifndef XY_DUMMY_CLASS #define XY_DUMMY_CLASS(XY_UNIQUE_NAME) \ @interface XY_DUMMY_CLASS_ ## XY_UNIQUE_NAME : NSObject @end \ @implementation XY_DUMMY_CLASS_ ## XY_UNIQUE_NAME @end #endif // ---------------------------------- // Version // ---------------------------------- #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0 #endif // ---------------------------------- // Meta macro // ---------------------------------- #import "XYMetamacros.h" #ifndef uxy_cstr // 宏定义字符串 to char, NSString #define uxy_macro_cstr(A) __uxy_macro_cstr_(A) #define __uxy_macro_cstr_(A) #A #define uxy_macro_string(A) __uxy_macro_string_(A) #define __uxy_macro_string_(A) @#A // 定义静态常量字符串 #define uxy_staticConstString(__string) static const char *__string = #__string; #endif // ---------------------------------- // ... // ---------------------------------- #endif #pragma mark- #import <Foundation/Foundation.h> @interface XYQuick_Predefine : NSObject @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/LKDBHelperExtension.h
// // LKDBHelperExtension.h // JoinShow // // Created by Heaven on 13-10-31. // Copyright (c) 2013年 Heaven. All rights reserved. // #define XY_LKDBHelper_loadCount 20 #import "LKDBHelper.h" @interface NSObject(XY_LKDBHelper) - (void)loadFromDB; + (NSString *)primaryKeyAndDESC; @end @interface NSArray(XY_LKDBHelper) - (void)saveAllToDB; + (id)loadFromDBWithClass:(Class)modelClass; @end
uxyheaven/XYQuick
Pod/Classes/ui/modules/XYTabBarController.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <UIKit/UIKit.h> #import "XYTabBar.h" #pragma mark - #pragma mark- #pragma mark- XYTabBarController @protocol XYTabBarControllerDelegate; @interface XYTabBarController : UIViewController<XYTabBarDelegate> #pragma mark- model // 定义model @property (nonatomic, assign) NSUInteger selectedIndex; @property (nonatomic, weak, readonly) UIViewController *selectedViewController; @property (nonatomic, strong, readonly) NSArray *viewControllers; @property (nonatomic, assign) CGRect tabBarFrame; // the default height is 49 at bottom. @property (nonatomic, assign) CGRect contentFrame; // the default frame is self.view.bounds without tabBarFrame #pragma mark- view // 定义view @property (nonatomic, strong, readonly) XYTabBar *tabBar; @property (nonatomic, strong, readonly) UIView *contentView; // 子视图控制器显示的view @property (nonatomic, weak) id<XYTabBarControllerDelegate> delegate; // item: @{@"normal" :img1, @"highlighted" :img2, @"selected" :img3, @"disabled":img4, @"text": text} - (id)initWithViewControllers:(NSArray *)vcs items:(NSArray *)items; // 可以重载这个方法, 自定义item的位置和图片文字尺寸 - (void)setupItem:(UIButton *)item index:(NSInteger)index; // 重载这个方式, 自定义animatedView的位置 - (void)resetAnimatedView:(UIImageView *)animatedView index:(NSInteger)index; // 重载这个方法设置TabBar透明前和透明后的content尺寸 //- (void)setTabBarTransparent:(BOOL)b; @end #pragma mark- #pragma mark- XYTabBarControllerProtocol @protocol XYTabBarControllerProtocol <NSObject> @optional - (BOOL)tabBarController:(XYTabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController; - (void)tabBarController:(XYTabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController; @end #pragma mark- #pragma mark- XYTabBarController() @interface UIViewController (XYTabBarController) @property(nonatomic, weak, readonly) XYTabBarController *xyTabBarController; @end
uxyheaven/XYQuick
Pod/Classes/core/modules/XYJSON.h
<gh_stars>100-1000 // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #pragma mark - #define JSON_string_options NSJSONReadingAllowFragments /* 在kvc中, 字串类型 可以被转化成基本的 数值类型, 所以在设计实体数据类的时候,如果属性是int bool float double, 无论服务器的值是字串还是数值,都可以转换成数值类型 */ #pragma mark - XYJSONAutoBinding /** * 通过 Protocol 确定 NSArray 解析的类 * 1. 声明一个协议 @protocol Man <XYJSONAutoBinding> @end * 2. 让一个实体类实现这个协议 @interface Man : NSObject <Man> * * 3. 申明属性实现了这个协议 @property(strong, nonatomic) NSArray <Man> *users; * * 通过 Protocol 确定属性用来解析的类 * 1. 声明一个协议 @protocol Man <XYJSONAutoBinding> @end * 2. 让一个实体类实现这个协议 @interface Man : NSObject <Man> * * 3. 申明属性实现了这个协议 @property(strong, nonatomic) Man <Man> *man; */ @protocol XYJSONAutoBinding <NSObject> @end #define uxy_as_JSONAutoParse( __name ) \ @protocol __name <XYJSONAutoBinding> @end \ /// 符合XYJSON协议的对象可以返回JSON字串和JSON字典, 暂时不支持复杂的对象 @protocol XYJSON <NSObject> /// 返回对象的JSON字串 - (NSString *)uxy_JSONString; /// 返回对象的JSON字典 - (NSDictionary *)uxy_JSONDictionary; @end @interface NSObject (XYJSON_2) /** * @brief 如果model需要取父类的属性,那么需要自己实现这个方法,并且返回YES */ + (BOOL)uxy_hasSuperProperties; /// @brief 为属性添加别名, 处理服务器返回的时候key起名和native的属性不对应问题 + (void)uxy_addNickname:(NSString *)nicename forProperty:(NSString *)property; @end @interface NSData (XYJSON_2) /// 是否保持JSON对象缓存, 默认关闭. 在需要用KeyPath解析多个对象的时候可以开启, 以提高效率 @property (nonatomic, assign) BOOL uxy_keepJSONObjectCache; /// JSON对象缓存 @property (nonatomic, strong) id uxy_JSONObjectCache; /// 返回JSON字串 - (NSString *)uxy_JSONString; /// 返回JSON对象 - (id)uxy_JSONObject; // JSON to Model - (id)uxy_JSONObjectByClass:(Class)classType; - (id)uxy_JSONObjectByClass:(Class)classType forKeyPath:(NSString *)keyPath; @end @interface NSString (XYJSON_2) /// 是否保持JSON对象缓存, 默认关闭. 在需要用KeyPath解析多个对象的时候可以开启, 以提高效率 @property (nonatomic, assign) BOOL uxy_keepJSONObjectCache; /// JSON对象缓存 @property (nonatomic, strong) id uxy_JSONObjectCache; /// 返回JSON对象 - (id)uxy_JSONObject; // JSON to Model - (id)uxy_JSONObjectByClass:(Class)classType; - (id)uxy_JSONObjectByClass:(Class)classType forKeyPath:(NSString *)keyPath; @end @interface NSDictionary (XYJSON_2) - (NSString *)uxy_JSONString; - (NSData *)uxy_JSONData; @end @interface NSArray (XYJSON_2) @end
uxyheaven/XYQuick
Pod/Classes/ui/modules/XYViewLayout.h
<filename>Pod/Classes/ui/modules/XYViewLayout.h // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // This file Copy from ios-view-frame-builder. #import "XYQuick_Predefine.h" #import <UIKit/UIKit.h> #pragma mark - typedef NS_ENUM(NSUInteger, XYViewFrameBuilderDirection) { XYViewFrameBuilderDirectionRight = 0, XYViewFrameBuilderDirectionLeft, XYViewFrameBuilderDirectionUp, XYViewFrameBuilderDirectionDown, }; @interface XYViewFrameBuilder : NSObject @property (nonatomic, assign, readonly) UIView *view; @property (nonatomic) BOOL automaticallyCommitChanges; // Default is YES - (id)initWithView:(UIView *)view; + (XYViewFrameBuilder *)frameBuilderForView:(UIView *)view; - (void)commit; - (void)reset; - (void)update:(void (^)(XYViewFrameBuilder *builder))block; // Configure - (XYViewFrameBuilder *)enableAutoCommit; - (XYViewFrameBuilder *)disableAutoCommit; // Move - (XYViewFrameBuilder *)setX:(CGFloat)x; - (XYViewFrameBuilder *)setY:(CGFloat)y; - (XYViewFrameBuilder *)setOriginWithX:(CGFloat)x y:(CGFloat)y; - (XYViewFrameBuilder *)moveWithOffsetX:(CGFloat)offsetX; - (XYViewFrameBuilder *)moveWithOffsetY:(CGFloat)offsetY; - (XYViewFrameBuilder *)moveWithOffsetX:(CGFloat)offsetX offsetY:(CGFloat)offsetY; - (XYViewFrameBuilder *)centerInSuperview; - (XYViewFrameBuilder *)centerHorizontallyInSuperview; - (XYViewFrameBuilder *)centerVerticallyInSuperview; - (XYViewFrameBuilder *)alignToTopInSuperviewWithInset:(CGFloat)inset; - (XYViewFrameBuilder *)alignToBottomInSuperviewWithInset:(CGFloat)inset; - (XYViewFrameBuilder *)alignLeftInSuperviewWithInset:(CGFloat)inset; - (XYViewFrameBuilder *)alignRightInSuperviewWithInset:(CGFloat)inset; - (XYViewFrameBuilder *)alignToTopInSuperviewWithInsets:(UIEdgeInsets)insets; - (XYViewFrameBuilder *)alignToBottomInSuperviewWithInsets:(UIEdgeInsets)insets; - (XYViewFrameBuilder *)alignLeftInSuperviewWithInsets:(UIEdgeInsets)insets; - (XYViewFrameBuilder *)alignRightInSuperviewWithInsets:(UIEdgeInsets)insets; - (XYViewFrameBuilder *)alignToTopOfView:(UIView *)view offset:(CGFloat)offset; - (XYViewFrameBuilder *)alignToBottomOfView:(UIView *)view offset:(CGFloat)offset; - (XYViewFrameBuilder *)alignLeftOfView:(UIView *)view offset:(CGFloat)offset; - (XYViewFrameBuilder *)alignRightOfView:(UIView *)view offset:(CGFloat)offset; + (void)alignViews:(NSArray *)views direction:(XYViewFrameBuilderDirection)direction spacing:(CGFloat)spacing; + (void)alignViews:(NSArray *)views direction:(XYViewFrameBuilderDirection)direction spacingWithBlock:(CGFloat (^)(UIView *firstView, UIView *secondView))block; + (void)alignViewsVertically:(NSArray *)views spacing:(CGFloat)spacing; + (void)alignViewsVertically:(NSArray *)views spacingWithBlock:(CGFloat (^)(UIView *firstView, UIView *secondView))block; + (void)alignViewsHorizontally:(NSArray *)views spacing:(CGFloat)spacing; + (void)alignViewsHorizontally:(NSArray *)views spacingWithBlock:(CGFloat (^)(UIView *firstView, UIView *secondView))block; + (CGFloat)heightForViewsAlignedVertically:(NSArray *)views spacing:(CGFloat)spacing; + (CGFloat)heightForViewsAlignedVertically:(NSArray *)views spacingWithBlock:(CGFloat (^)(UIView *firstView, UIView *secondView))block; + (CGFloat)heightForViewsAlignedVertically:(NSArray *)views constrainedToWidth:(CGFloat)constrainedWidth spacing:(CGFloat)spacing; + (CGFloat)heightForViewsAlignedVertically:(NSArray *)views constrainedToWidth:(CGFloat)constrainedWidth spacingWithBlock:(CGFloat (^)(UIView *firstView, UIView *secondView))block; // Resize - (XYViewFrameBuilder *)setWidth:(CGFloat)width; - (XYViewFrameBuilder *)setHeight:(CGFloat)height; - (XYViewFrameBuilder *)setSize:(CGSize)size; - (XYViewFrameBuilder *)setSizeWithWidth:(CGFloat)width height:(CGFloat)height; - (XYViewFrameBuilder *)setSizeToFitWidth; - (XYViewFrameBuilder *)setSizeToFitHeight; - (XYViewFrameBuilder *)setSizeToFit; + (void)sizeToFitViews:(NSArray *)views; @end @interface UIView (uxy_frameBuilder) - (XYViewFrameBuilder *)uxy_frameBuilder; @end @interface UIView (uxy_positioning) @property (nonatomic, assign) CGFloat uxy_x; @property (nonatomic, assign) CGFloat uxy_y; @property (nonatomic, assign) CGFloat uxy_width; @property (nonatomic, assign) CGFloat uxy_height; @property (nonatomic, assign) CGPoint uxy_origin; @property (nonatomic, assign) CGSize uxy_size; @property (nonatomic, assign) CGFloat uxy_bottom; @property (nonatomic, assign) CGFloat uxy_right; @property (nonatomic, assign) CGFloat uxy_centerX; @property (nonatomic, assign) CGFloat uxy_centerY; @property (nonatomic, weak, readonly) UIView *uxy_lastSubviewOnX; @property (nonatomic, weak, readonly) UIView *uxy_lastSubviewOnY; @end
uxyheaven/XYQuick
Example/XYQuick/Controller/ViewControllerDemo.h
// // ViewControllerDemo.h // JoinShow // // Created by heaven on 15/7/7. // Copyright (c) 2015年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> #import "XYQuick_Predefine.h" @protocol ViewControllerDemo <NSObject> + (NSString *)title; @end #define ViewControllerDemoTitle( __title ) \ + (NSString *)title { return uxy_macro_string( __title ); }
uxyheaven/XYQuick
Pod/Classes/core/modules/debug/XYDebugToy.h
<gh_stars>100-1000 // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #pragma mark - #pragma mark - XYDebugToy // 这个个debug的玩具类 @interface XYDebugToy : NSObject // 当被观察的对象释放的时候打印一段String + (void)hookObject:(id)anObject whenDeallocLogString:(NSString *)string; /** * @brief 提取视图层次结构的方法 * @param aView 要提取的视图 * @param indent 层次 请给0值 * @param outstring 保存层次的字符串 */ + (void)dumpView:(UIView *)aView atIndent:(int)indent into:(NSMutableString *)outstring; // 打印视图层次结构 + (NSString *)displayViews:(UIView *)aView; @end #pragma mark - XYDebug #undef XY_PRINT_CALLSTACK #define XY_PRINT_CALLSTACK( __n ) [XYDebug printCallstack:__n]; // 断点 #undef XY_BREAK_POINT #define XY_BREAK_POINT() [XYDebug breakPoint]; #undef XY_BREAK_POINT_IF #define XY_BREAK_POINT_IF( __x ) if ( __x ) { [XYDebug breakPoint]; } #undef XY_BB #define XY_BB [XYDebug breakPoint]; #ifdef DEBUG #define uxy_breakPoint_on_debug asm("int3") #else #define uxy_breakPoint_on_debug #endif // 验证 #define XY_ASSERT_RETURN_ON_RELEASE( __condition, __desc, ... ) \ metamacro_if_eq(0, metamacro_argcount(__VA_ARGS__)) \ (__XY_ASSERT_1(__condition, __desc, __VA_ARGS__)) \ (__XY_ASSERT_2(__condition, __desc, __VA_ARGS__)) #define __XY_ASSERT_1( __condition, __desc ) \ if ( !(__condition) ) uxy_breakPoint_on_debug; \ else return; #define __XY_ASSERT_2( __condition, __desc, __returnedValue ) \ if ( !(__condition) ) uxy_breakPoint_on_debug; \ else return __returnedValue; // 这个类名字需要在想下 @interface XYDebug : NSObject + (instancetype)sharedInstance; + (void)purgeSharedInstance; + (NSArray *)callstack:(NSUInteger)depth; + (void)printCallstack:(NSUInteger)depth; + (void)breakPoint; + (void)breakPointOnDebug; // memory - (void)allocAllMemory; - (void)freeAllMemory; - (void)allocMemory:(NSInteger)MB; - (void)freeLastMemory; /// window上的调试的label + (UILabel *)debugLabel; @end; // uiview点击时 加边框 @interface UIWindow(XYDebug) /// 调试用的label, tag = 66666, 可以在viewDidAppear or 其他方法里添加当前页面的调试信息 @property (nonatomic, strong, readonly) UILabel *uxy_debugLabel; @end #pragma mark - BorderView @interface BorderView : UIView - (void)startAnimation; @end
uxyheaven/XYQuick
Pod/Classes/ui/extension/UIControl+XY.h
<reponame>uxyheaven/XYQuick<gh_stars>100-1000 // // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // This file Copy from BlockUI. #import "XYQuick_Predefine.h" #import <UIKit/UIKit.h> #pragma mark - /* typedef NS_OPTIONS(NSUInteger, UIControlEvents) { UIControlEventTouchDown = 1 << 0, // on all touch downs UIControlEventTouchDownRepeat = 1 << 1, // on multiple touchdowns (tap count > 1) UIControlEventTouchDragInside = 1 << 2, UIControlEventTouchDragOutside = 1 << 3, UIControlEventTouchDragEnter = 1 << 4, UIControlEventTouchDragExit = 1 << 5, UIControlEventTouchUpInside = 1 << 6, UIControlEventTouchUpOutside = 1 << 7, UIControlEventTouchCancel = 1 << 8, UIControlEventValueChanged = 1 << 12, // sliders, etc. UIControlEventEditingDidBegin = 1 << 16, // UITextField UIControlEventEditingChanged = 1 << 17, UIControlEventEditingDidEnd = 1 << 18, UIControlEventEditingDidEndOnExit = 1 << 19, // 'return key' ending editing UIControlEventAllTouchEvents = 0x00000FFF, // for touch events UIControlEventAllEditingEvents = 0x000F0000, // for UITextField UIControlEventApplicationReserved = 0x0F000000, // range available for application use UIControlEventSystemReserved = 0xF0000000, // range reserved for internal framework use UIControlEventAllEvents = 0xFFFFFFFF }; */ @interface UIControl (XYExtension) - (void)uxy_handleControlEvent:(UIControlEvents)event withBlock:(void(^)(id sender))block; - (void)uxy_removeHandlerForEvent:(UIControlEvents)event; @end
uxyheaven/XYQuick
Example/XYQuick/Model/Associated.h
// // Associated.h // JoinShow // // Created by Heaven on 15/8/28. // Copyright (c) 2015年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> #import "XYQuick.h" @interface Associated : NSObject @end @interface Associated (test) @uxy_property_basicDataType(int, age); @uxy_property_basicDataType(NSTimeInterval, time); @uxy_property_copy(NSString *, name); @uxy_property_weak(NSDate *, date); @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYChainMethod.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef JoinShow_XYChainMethod_h_h #define JoinShow_XYChainMethod_h_h #import "XYQuick_Predefine.h" // ---------------------------------- // public // ---------------------------------- #define uxy_as_chainMethod(__blockType, __methodName) \ - (__blockType)__methodName; #define uxy_def_chainMethod(__blockType, __methodName, ...) \ metamacro_if_eq(1, metamacro_argcount(__VA_ARGS__)) \ (__uxy_chainMethod_1(__blockType, __methodName, __VA_ARGS__)) \ (__uxy_chainMethod_2(__blockType, __methodName, __VA_ARGS__)) // ---------------------------------- // private // ---------------------------------- #define __uxy_chainMethod_1(__blockType, __methodName, __propertyName) \ - (__blockType)__methodName \ { \ __blockType block = ^ id (id __propertyName){ \ self.__propertyName = __propertyName; \ return self; \ }; \ return block; \ } #define __uxy_chainMethod_2(__blockType, __methodName, __propertyName, __defaultValue) \ - (__blockType)__methodName \ { \ __blockType block = ^ id (void){ \ self.__propertyName = __defaultValue; \ return self; \ }; \ return block; \ } #endif
uxyheaven/XYQuick
Pod/Classes/ui/XYQuick_UI.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import <Foundation/Foundation.h> // Modules #import "XYUIDefine.h" // 一些ui相关宏定义 #import "XYAnimate.h" // 普通动画 #import "XYKeyboardHelper.h" // Keyboard偏移通用解决方案 #import "XYTabBarController.h" // TabBarController #import "XYBaseViewController.h" // UIViewController 生命周期扩展 #import "XYViewLayout.h" // UIView 布局 #import "XYViewControllerManager.h" // XYViewControllerManager // Extensions #import "UIColor+XY.h" #import "UIControl+XY.h" #import "UIView+XY.h" #import "UIImage+XY.h" #import "UIAlertView+XY.h" #import "UIActionSheet+XY.h" #import "UILabel+XY.h" #import "UITable+XY.h" #import "UIWebView+XY.h" #import "UIButton+XY.h" #import "UINavigationBar+XY.h" #import "UIViewController+XY.h" #import "UIWindow+XY.h" // Protocol #import "XYHUDProtocol.h" // HUD协议 /**************************************************************/ static __inline__ CGRect CGRectFromCGSize( CGSize size ) { return CGRectMake( 0, 0, size.width, size.height ); }; static __inline__ CGRect CGRectMakeWithCenterAndSize( CGPoint center, CGSize size ) { return CGRectMake( center.x - size.width * 0.5, center.y - size.height * 0.5, size.width, size.height ); }; static __inline__ CGRect CGRectMakeWithOriginAndSize( CGPoint origin, CGSize size ) { return CGRectMake( origin.x, origin.y, size.width, size.height ); }; static __inline__ CGPoint CGRectCenter( CGRect rect ) { return CGPointMake( CGRectGetMidX( rect ), CGRectGetMidY( rect ) ); };
uxyheaven/XYQuick
Pod/Classes/core/modules/debug/XYUnitTest.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // This file Copy from Samurai. #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #pragma mark - #define UXY_TEST_CASE( __module, __name ) \ @interface __TestCase__##__module##_##__name : XYTestCase \ @end \ @implementation __TestCase__##__module##_##__name #define UXY_TEST_CASE_END \ @end // 测试的方法 #define UXY_DESCRIBE( ... ) \ - (void) metamacro_concat( runTest_, __LINE__ ) #define UXY_REPEAT( __n ) \ for ( int __i_##__LINE__ = 0; __i_##__LINE__ < __n; ++__i_##__LINE__ ) // 验证 #define UXY_EXPECTED( ... ) \ if ( !(__VA_ARGS__) ) \ { \ [[XYUnitTest sharedInstance] writeLog:@"✖ EXPECTED( %s )", #__VA_ARGS__]; \ [[XYUnitTest sharedInstance] flushLog]; \ @throw [XYTestFailure expr:#__VA_ARGS__ file:__FILE__ line:__LINE__]; \ } #define UXY_TIMES( __n ) \ /* [[XYUnitTest sharedInstance] writeLog:@"Loop %d times @ %@(#%d)", __n, [@(__FILE__) lastPathComponent], __LINE__]; */ \ for ( int __i_##__LINE__ = 0; __i_##__LINE__ < __n; ++__i_##__LINE__ ) #define UXY_TEST( __name, __block ) \ [[XYUnitTest sharedInstance] writeLog:@"> %@", @(__name)]; \ __block #pragma mark - #if (1 == __XY_DEBUG_UNITTESTING__) @interface XYTestFailure : NSException @property (nonatomic, copy) NSString *expr; @property (nonatomic, copy) NSString *file; @property (nonatomic, assign) NSInteger line; + (XYTestFailure *)expr:(const char *)expr file:(const char *)file line:(int)line; @end #pragma mark - @interface XYTestCase : NSObject @end #pragma mark - @interface XYUnitTest : NSObject + (instancetype)sharedInstance; + (void)purgeSharedInstance; @property (nonatomic, assign) NSUInteger failedCount; @property (nonatomic, assign) NSUInteger succeedCount; - (void)run; - (void)writeLog:(NSString *)format, ...; - (void)flushLog; @end #endif
uxyheaven/XYQuick
Example/XYQuick/Model/AutoCodingEntity.h
// // AutoCodingEntity.h // JoinShow // // Created by Heaven on 14/10/31. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> @class AutoCodingEntityOther; @interface AutoCodingEntityList : NSObject @property (nonatomic, strong) NSMutableArray *array; @end @interface AutoCodingEntityBase : NSObject @property (nonatomic, copy) NSString *str; @property (nonatomic, assign) float f; @end @interface AutoCodingEntity : AutoCodingEntityBase @property (nonatomic, strong) NSNumber *num; @property (nonatomic, assign) int i; @property (nonatomic, assign) BOOL b; @property (nonatomic, strong) AutoCodingEntityOther *objc; @end @interface AutoCodingEntityOther : NSObject @property (nonatomic, assign) int i; @end
uxyheaven/XYQuick
Example/XYQuick/Model/RubyChinaNodeEntity.h
// // RubyChinaNodeEntity.h // JoinShow // // Created by Heaven on 13-10-31. // Copyright (c) 2013年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> #import "XYQuick.h" @protocol RubyChinaNodeEntity <NSObject> @end @interface RubyChinaNodeEntity : NSObject <XYJSONAutoBinding> @property (nonatomic, assign) int nodeID; @property (nonatomic, strong) NSString *name; @property (nonatomic, assign) int topics_count; @property (nonatomic, strong) NSString *summary; @property (nonatomic, assign) int section_id; @property (nonatomic, assign) int sort; @property (nonatomic, strong) NSString *section_name; @property (nonatomic, strong) RubyChinaNodeEntity *nextNode; @property (nonatomic, strong) NSArray <RubyChinaNodeEntity> *array; @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/XYAppModuleProtocol.h
<reponame>uxyheaven/XYQuick // // XYAppModuleProtocol.h // JoinShow // // Created by heaven on 14/12/19. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <Foundation/Foundation.h> @protocol XYAppModuleProtocol <NSObject> @property (nonatomic, copy, readonly) NSString *name; // 名字 @property (nonatomic, copy, readonly) NSString *icon; // 图标 @property (nonatomic, copy, readonly) NSString *rootViewControllerKey; // 模块的根viewcontroller的key // 设置模块的viewController - (void)setupViewControllers; // 设置模块之间的数据交换 - (void)setupCooperatives; @end
uxyheaven/XYQuick
Example/XYQuick/Laboratory/module/XYWidget.h
<reponame>uxyheaven/XYQuick // // XYWidget.h // XYQuick // // Created by heaven on 2016/12/22. // Copyright © 2016年 xingyao095. All rights reserved. // #import <Foundation/Foundation.h> @interface XYWidget : NSObject @property (nonatomic, strong, readonly) NSDictionary *data; @property (nonatomic, strong, readonly) UIView *view; #pragma mark - API @end
uxyheaven/XYQuick
Example/XYQuick/Controller/DemoViewController.h
// // DemoViewController.h // JoinShow // // Created by Heaven on 14-4-2. // Copyright (c) 2014年 Heaven. All rights reserved. // #import <UIKit/UIKit.h> #define DemoViewController_sel_methodBlock @selector(funny:) #define DemoViewController_sel_methodBlock2 @selector(funny2:) typedef void(^DemoViewControllerExecuteBlock)(UIViewController *vc); typedef void(^DemoViewControllerFunBlock)(UIViewController *vc, id sender); @interface DemoViewController : UIViewController @property (nonatomic, copy) NSString *name; @property (nonatomic, strong) DemoViewControllerExecuteBlock loadViewBlock; @property (nonatomic, strong) DemoViewControllerExecuteBlock viewDidLoadBlock; @property (nonatomic, strong) DemoViewControllerFunBlock methodBlock; @property (nonatomic, strong) DemoViewControllerFunBlock methodBlock2; //- (void)memoryWarning; @end
uxyheaven/XYQuick
Pod/Classes/event/modules/XYSignal.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #pragma mark - #define uxy_handleSignal( __signal, __name ) \ - (void)__uxy_handleSignal_n_##__name:(XYSignal *)__signal #pragma mark - // 声明 定义 #define uxy_as_def_signal( __name ) \ static NSString *const __name = uxy_macro_string(__name); #pragma mark - #pragma mark - XYSignalTarget @protocol XYSignalTarget @property (nonatomic, weak) id uxy_nextSignalHandler; @property (nonatomic, weak, readonly) id uxy_defaultNextSignalHandler; @end #pragma mark - Request && Response @interface XYSignal : NSObject // Request @property (nonatomic, assign) BOOL isDead; // 是否结束 @property (nonatomic, assign) BOOL isReach; // 是否触达最后的Handler @property (nonatomic, weak) id<XYSignalTarget> sender; // 发送者 @property (nonatomic, assign) NSInteger jump; // 跳转次数 @property (nonatomic, copy) NSString *name; // 名字 @property (nonatomic, strong) id userInfo; // 请求的参数 // Response @property (nonatomic, strong) id response; // 返回值 @end #pragma mark- UXYSignalHandler @interface NSObject (XYSignalHandler) - (XYSignal *)uxy_sendSignalWithName:(NSString *)name userInfo:(id)userInfo; - (XYSignal *)uxy_sendSignalWithName:(NSString *)name userInfo:(id)userInfo sender:(id)sender; @end @interface UIView (XYSignalHandler)<XYSignalTarget> @end @interface UIViewController (XYSignalHandler)<XYSignalTarget> @end #pragma mark - XYSignalBus // 暂时无用 /* @interface XYSignalBus : NSObject + (instancetype)defaultBus; @end */
uxyheaven/XYQuick
Pod/Classes/core/modules/XYCommon.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import "XYQuick_Predefine.h" #import <Foundation/Foundation.h> #pragma mark - // 一大堆零散的方法 // 这个类要慢慢废弃 @class MBProgressHUD; @class ASIHTTPRequest; @class XYCommon; #undef $ #define $ __getTestBlock( self ) typedef XYCommon * (^XYCommonBlockTest)( id first, ... ); typedef XYCommonBlockTest (^XYCommonContextBlock)( id context ); XYCommonBlockTest __getTestBlock( id context ); @interface XYCommon : NSObject{ } typedef enum { MarkOption_middle = 1, MarkOption_front, MarkOption_back, } MarkOption; /** * @brief 返回字符串的位置的方法 * @param rangeOfString:返回range. rangeArrayOfString:返回range数组 * @param str 在str中查找 * @param iStart 查找起始位置 * @param strMark 需要查找的字符串的标记 * @param strStart 起始标记 * @param strEnd 结束标记 * @param operation 模式. MarkOption_middle mark在Start和end中间,当Start=mark时,返回 Start和end中间的Range, MarkOption_front: mark在Start和end前面,MarkOption_back: mark在Start和end后面 * @param block 每一个字符串都执行该block * @return 范围 */ + (NSRange)rangeOfString:(NSString *)str pointStart:(NSUInteger)iStart start:(NSString *)strStart end:(NSString *)strEnd mark:(NSString *)strMark operation:(MarkOption)operation; + (NSMutableArray *)rangeArrayOfString:(NSString *)str pointStart:(NSUInteger)iStart start:(NSString *)strStart end:(NSString *)strEnd mark:(NSString *)strMark operation:(MarkOption)operation; + (NSMutableArray *)rangeArrayOfString:(NSString *)str pointStart:(NSUInteger)iStart start:(NSString *)strStart end:(NSString *)strEnd mark:(NSString *)strMark operation:(MarkOption)operation everyStringExecuteBlock:(void(^)(NSRange rangeEvery))block; #define XYCommon_lastLocation -1 /** * @brief 返回没有属性的xml中指定节点的值的方法 * @param str xml字符串 * @param akey 节点名 * @param location 起始位置 * @param operation 模式. XYCommon_lastLocation 从上次结束的位置开始查找,提高效率 * @return 返回没有属性的xml中指定节点的值 */ + (NSString *)getValueInANonAttributeXMLNode:(NSString *)str key:(NSString *)akey location:(int)location; /** * @brief 正则表达式分析字符串的方法 * @param analyseString 返回NSString数组. analyseStringToRange:返回range数组 * @param str 被分析的字符串 * @param regexStr 用于分析str的正则表达式 (.|[\r\n])*? 表示任何多个字符,包括换行符,懒惰扫描 * @param options (已取消)匹配选项使用 * @return 结果的字符串的array */ + (NSMutableArray *)analyseString:(NSString *)str regularExpression:(NSString *)regexStr; + (NSMutableArray *)analyseStringToRange:(NSString *)str regularExpression:(NSString *)regexStr; #pragma mark todo, 分享facebook,发EMail /** * @brief 分享至Twitter的方法 * @param strText 需要分享的文字 * @param picPath 图片路径 * @param strURL URL地址 * @param vc Twitter的父视图控制器,目前版本请用nil,默认为[UIApplication sharedApplication].delegate.window.rootViewControlle */ + (void)shareToTwitterWithStr:(NSString *)strText withPicPath:(NSString *)picPath withURL:(NSString*)strURL inController:(id)vc; /** * @brief 返回UUID * @return UUID */ + (NSString *)UUID; // 没有"-" + (NSString *)UUIDWithoutMinus; /** * @brief 用[UIApplication sharedApplication]打开一个URL * @param url http:// 浏览器, mailto:// 邮件, tel:// 拨号, sms: 短信 */ + (void)openURL:(NSURL *)URL; #define SHOWMSG(title, msg, cancel) [XYCommon showAlertViewTitle:title message:msg cancelButtonTitle:cancel]; /** * @brief 显示UIAlertView * @param aTitle msg标题 * @param msg 信息 * @param strCancel 取消按钮标题 */ + (void)showAlertViewTitle:(NSString *)aTitle message:(NSString *)msg cancelButtonTitle:(NSString *)strCancel; /** * @brief 版本号比大小, Version format[X.X.X] * @param oldVersion 旧版本号 * @param newVersion 新版本号 * @return 比较oldVersion和newVersion, NSOrderedAscending 左边比右边的小 */ + (NSComparisonResult)compareVersionFromOldVersion:(NSString *)oldVersion newVersion:(NSString *)newVersion; @end
uxyheaven/XYQuick
Pod/Classes/event/modules/XYMulticastDelegate.h
// // __ __ ____ _ _ // \ \/ / /\_/\ /___ \ _ _ (_) ___ | | __ // \ / \_ _/ // / / | | | | | | / __| | |/ / // / \ / \ / \_/ / | |_| | | | | (__ | < // /_/\_\ \_/ \___,_\ \__,_| |_| \___| |_|\_\ // // Copyright (C) Heaven. // // https://github.com/uxyheaven/XYQuick // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // This file Copy from GCDMulticastDelegate. #import <Foundation/Foundation.h> @class XYMulticastDelegateEnumerator; /** * This class provides multicast delegate functionality. That is: * - it provides a means for managing a list of delegates * - any method invocations to an instance of this class are automatically forwarded to all delegates * * For example: * * // Make this method call on every added delegate (there may be several) * [multicastDelegate cog:self didFindThing:thing]; * * This allows multiple delegates to be added to an xmpp stream or any xmpp module, * which in turn makes development easier as there can be proper separation of logically different code sections. * * In addition, this makes module development easier, * as multiple delegates can be handled in the same manner as the traditional single delegate paradigm. * * This class also provides proper support for GCD queues. * So each delegate specifies which queue they would like their delegate invocations to be dispatched onto. * * All delegate dispatching is done asynchronously (which is a critically important architectural design). **/ #import "XYQuick_Predefine.h" #pragma mark - @interface XYMulticastDelegate : NSObject - (void)addDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue; - (void)removeDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue; - (void)removeDelegate:(id)delegate; - (void)removeAllDelegates; - (NSUInteger)count; - (NSUInteger)countOfClass:(Class)aClass; - (NSUInteger)countForSelector:(SEL)aSelector; - (XYMulticastDelegateEnumerator *)delegateEnumerator; @end @interface XYMulticastDelegateEnumerator : NSObject - (NSUInteger)count; - (NSUInteger)countOfClass:(Class)aClass; - (NSUInteger)countForSelector:(SEL)aSelector; - (BOOL)getNextDelegate:(id *)delPtr delegateQueue:(dispatch_queue_t *)dqPtr; - (BOOL)getNextDelegate:(id *)delPtr delegateQueue:(dispatch_queue_t *)dqPtr ofClass:(Class)aClass; - (BOOL)getNextDelegate:(id *)delPtr delegateQueue:(dispatch_queue_t *)dqPtr forSelector:(SEL)aSelector; @end